|
1 | | -## Basic functions |
| 1 | +## Basic Functions |
2 | 2 |
|
3 | 3 | - ### **`load_ggplot(ggplot=None, figsize=None)`** |
4 | 4 |
|
|
8 | 8 |
|
9 | 9 | - `ggplot`: plotnine.ggplot.ggplot |
10 | 10 | - `figsize`: tuple (float, float) |
11 | | - Figure size. If it is not specified, the generated Bricks object would keep the |
12 | | - original figure size of the given ggplot objecrt. |
| 11 | + Figure size. If it is not specified, the generated Bricks object will keep the |
| 12 | + original figure size of the given ggplot object. |
13 | 13 |
|
14 | 14 | #### Returns |
15 | 15 |
|
16 | 16 | `patchworklib.Bricks` object |
17 | 17 |
|
18 | | - |
19 | 18 | - ### **`overwrite_axisgrid()`** |
20 | 19 |
|
21 | 20 | Overwrite the `__init__` methods in `seaborn.axisgrid.xxGrid` classes. |
22 | 21 | The function changes the figure object given in the `__init__` functions of the |
23 | 22 | axisgrid class objects, which is used for drawing plots, to `_basefigure` |
24 | 23 | in the patchworklib. If you want to load the plots generated based on |
25 | | - `seabron.axisgrid.xxGrid` objects as `patchworklib.Brick(s)` object using |
| 24 | + `seaborn.axisgrid.xxGrid` objects as `patchworklib.Brick(s)` object using |
26 | 25 | `load_seaborngrid` function, you should execute this function in advance. |
27 | 26 |
|
28 | 27 | #### Returns |
|
32 | 31 | - ### **`load_seabornobj(g, label=None, labels=None, figsize=(3, 3))`** |
33 | 32 |
|
34 | 33 | Load a seaborn plot generated based on `seaborn._core.plot.Plotter` class. |
35 | | - The method is prototype version. By using this function, plots generated |
| 34 | + The method is a prototype version. By using this function, plots generated |
36 | 35 | using [object-oriented seaborn interface](https://seaborn.pydata.org/tutorial/objects_interface.html) can be handled as a `patchworklib.Brick(s)` |
37 | 36 | class object. |
38 | 37 |
|
39 | 38 | #### Parameters |
40 | 39 |
|
41 | 40 | - `g`: `seaborn.axisgrid.xxGrid` object |
42 | 41 | A return value of the seaborn figure-level plotting functions such as relplot, |
43 | | - distplot, catplot, jointplot and pairplot. |
| 42 | + distplot, catplot, jointplot, and pairplot. |
44 | 43 | - `label`: str |
45 | 44 | Unique identifier for the `patchworklib.Brick(s)` class object to be returned. |
46 | 45 | If you want to adjust a layout composed of multiple bricks object using the label |
47 | 46 | indexing method, providing the unique label name for returned object should be |
48 | 47 | encouraged. |
49 | 48 | - `figsize`: tuple (float, float) |
50 | | - Figure size. If it is not specified, convert Bricks object would keep the original |
| 49 | + Figure size. If it is not specified, the converted Bricks object will keep the original |
51 | 50 | figure size of the given seaborn plot. |
52 | 51 |
|
53 | 52 | #### Returns |
|
57 | 56 | - ### **`load_seaborngrid(g, label=None, labels=None, figsize=None)`** |
58 | 57 |
|
59 | 58 | Load seaborn plot generated based on seaborn.axisgrid.xxGrid class. |
60 | | - In generally, seaborn plots generated by figure-level fucntion cannot be |
61 | | - handles as subplot(s) with other matplotlib plots, However, by processing |
62 | | - these seaborn plots via the function, you can handle them as |
| 59 | + In general, seaborn plots generated by figure-level function cannot be |
| 60 | + handled as subplot(s) with other matplotlib plots. However, by processing |
| 61 | + these seaborn plots via this function, you can handle them as |
63 | 62 | `patchworklib.Brick(s)` class objects. |
64 | 63 |
|
65 | 64 | #### Notes |
|
70 | 69 |
|
71 | 70 | - `g`: seaborn.axisgrid.xxGrid object |
72 | 71 | A return value of the seaborn figure-level plotting functions such as relplot, |
73 | | - distplot, catplot, jointplot and pairplot. |
| 72 | + distplot, catplot, jointplot, and pairplot. |
74 | 73 | - `label`: str |
75 | 74 | Unique identifier for the `patchworklib.Brick(s)` class object to be returned. |
76 | 75 | If you want to adjust a layout composed of multiple bricks object using the label |
77 | 76 | indexing method, providing the unique label name for returned object should be |
78 | 77 | encouraged. |
79 | 78 | - `figsize`: tuple (float, float) |
80 | | - Figure size. If it is not specified, convert Bricks object would keep the original |
| 79 | + Figure size. If it is not specified, the converted Bricks object will keep the original |
81 | 80 | figure size of the given seaborn plot. |
82 | 81 |
|
83 | 82 | #### Returns |
|
86 | 85 |
|
87 | 86 | - ### **`hstack(brick1, brick2, target=None, margin=None, direction='r', adjust_height=True, adjust_width=True, va='top')`** |
88 | 87 |
|
89 | | - Align two `patchworlib.Brick(s)` objects horizontally. |
| 88 | + Align two `patchworklib.Brick(s)` objects horizontally. |
90 | 89 | When joining two Brick(s) objects by `"|"` or `"+"` operator, this function is called internally. |
91 | 90 |
|
92 | 91 | - `brick1 | brick2` is identical to `hstack(brick1, brick2)` |
|
96 | 95 | #### Parameters |
97 | 96 |
|
98 | 97 | - `brick1`: patchworklib.Brick or patchworklib.Bricks class object |
99 | | - A `patchworlib.Brick(s)` class object to be joined with `brick2` object. |
| 98 | + A `patchworklib.Brick(s)` class object to be joined with `brick2` object. |
100 | 99 | The location of this object is used as the base position for determining |
101 | 100 | the `brick2` placement. |
102 | 101 | - `brick2`: patchworklib.Brick or patchworklib.Bricks class object |
103 | | - A `patchworlib.Brick(s)` class object to be placed on the side specified by `direction` |
| 102 | + A `patchworklib.Brick(s)` class object to be placed on the side specified by `direction` |
104 | 103 | (by default, on the right side) of the `brick1` object. |
105 | 104 | - `target`: str, default: `None` |
106 | 105 | Unique label name of the Brick or Brick(s) object that is a part of the `brick1` |
107 | 106 | object. If you want to place `brick2` object next to the specific Brick(s) object |
108 | 107 | in `brick1` object, please provide the `label` value of the Brick(s) object. |
109 | 108 | - `margin`: float or str (`"none"`), default: `None` |
110 | 109 | Margin size between the two given Brick(s) objects. |
111 | | - If `None`, the `pw.param["margin"]` value would be used as the margin size. |
| 110 | + If `None`, the `pw.param["margin"]` value will be used as the margin size. |
112 | 111 | If the value is `"none"`, two Brick(s) objects will be joined with no margin |
113 | 112 | (meaning that the axes spines will be joined so that they are fully glued together). |
114 | 113 | - `direction`: str (`"r"` or `"l"`), default: `"r"` |
|
120 | 119 | - `adjust_width`: bool, default: `True` |
121 | 120 | If `True`, the width of `brick2` will be adjusted according to the aspect of `brick2` |
122 | 121 | after stacking. If False, `brick2` will keep its original width after stacking. |
123 | | - If `ajust_height` is `Fasle`, the value will also be `False`. |
| 122 | + If `adjust_height` is `False`, the value will also be `False`. |
124 | 123 | - `va`: str (`"top"` or `"bottom"`), default: `False` |
125 | | - If `adjsut_height` is `False`, the value will be effective. |
| 124 | + If `adjust_height` is `False`, the value will be effective. |
126 | 125 | If the value is `"top"`, `brick2` object will be aligned to the left/right top of `brick1` object. |
127 | 126 | If the value is `"bottom"`, `brick2` object will be aligned to the left/right bottom of `brick1` object. |
128 | 127 |
|
129 | 128 | #### Returns |
| 129 | + |
| 130 | + `patchworlib.Bricks` object |
| 131 | + |
130 | 132 |
|
131 | | - `patchworklib.Bricks` object |
132 | 133 |
|
133 | 134 | - ### **`vstack(brick1, brick2, target=None, margin=None, direction='t', adjust_height=True, adjust_width=True, ha='l')`** |
134 | 135 |
|
|
176 | 177 |
|
177 | 178 | `patchworlib.Bricks` object |
178 | 179 |
|
179 | | -- ### **`stack(bricks, margin=None, operator='|')`** |
| 180 | +- ### **`stack(bricks, margin=None, operator='|', equal_spacing=False)`** |
180 | 181 |
|
181 | 182 | Stack multiple Brick(s) objects horizontally or vetically. |
182 | 183 |
|
|
192 | 193 | Orientation of the arrangement for the given `patchworklib.Brick(s)` object. |
193 | 194 | If this value is `|` or `/`, the width/height of the object to be stacked will be |
194 | 195 | adjusted so that it will be aligned with previous one. |
195 | | - |
| 196 | + - `equal_spacing`: bool, default: `False` |
| 197 | + If this value is `True`, axes bounding-boxes should be placed with equal spacing |
| 198 | + between them. Otherwise, depending on the text values of x/y tick labels and x/y |
| 199 | + labels, they may not always be equally spaced. |
| 200 | + |
196 | 201 | #### Returns |
197 | 202 |
|
198 | 203 | `patchworlib.Bricks` object |
@@ -521,6 +526,23 @@ It can be joined with aother `patchworklib.Brick(s)` object by using `/`, `|`, ` |
521 | 526 | `matplotlib.spines.Spine` object |
522 | 527 |
|
523 | 528 |
|
| 529 | +- ### **`align_xlabels(self, keys=None)`** |
| 530 | + |
| 531 | + Align the xlabels of the specified Brick objects. |
| 532 | + |
| 533 | + #### Parameters |
| 534 | + |
| 535 | + - `keys`: `list` of `str` or `Brick` object |
| 536 | + The xlabels of the Brick objects specified by `keys` will be aligned. |
| 537 | + |
| 538 | +- ### **`align_ylabels(self, keys=None)`** |
| 539 | + |
| 540 | + Align the ylabels of the specified Brick objects. |
| 541 | + |
| 542 | + #### Parameters |
| 543 | + |
| 544 | + - `keys`: `list` of `str` or `Brick` object |
| 545 | + The ylabels of the Brick objects specified by `keys` will be aligned. |
524 | 546 |
|
525 | 547 | - ### **`add_colorbar(self, cmap=None, x=None, y=None, vmin=0, vmax=1, hratio=None, wratio=None, coordinate='relative', **args)`** |
526 | 548 |
|
|
0 commit comments