Skip to content

Commit f7ec196

Browse files
committed
Updated
1 parent 23b4783 commit f7ec196

File tree

2 files changed

+45
-23
lines changed

2 files changed

+45
-23
lines changed

API.md

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Basic functions
1+
## Basic Functions
22

33
- ### **`load_ggplot(ggplot=None, figsize=None)`**
44

@@ -8,21 +8,20 @@
88

99
- `ggplot`: plotnine.ggplot.ggplot
1010
- `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.
1313

1414
#### Returns
1515

1616
`patchworklib.Bricks` object
1717

18-
1918
- ### **`overwrite_axisgrid()`**
2019

2120
Overwrite the `__init__` methods in `seaborn.axisgrid.xxGrid` classes.
2221
The function changes the figure object given in the `__init__` functions of the
2322
axisgrid class objects, which is used for drawing plots, to `_basefigure`
2423
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
2625
`load_seaborngrid` function, you should execute this function in advance.
2726

2827
#### Returns
@@ -32,22 +31,22 @@
3231
- ### **`load_seabornobj(g, label=None, labels=None, figsize=(3, 3))`**
3332

3433
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
3635
using [object-oriented seaborn interface](https://seaborn.pydata.org/tutorial/objects_interface.html) can be handled as a `patchworklib.Brick(s)`
3736
class object.
3837

3938
#### Parameters
4039

4140
- `g`: `seaborn.axisgrid.xxGrid` object
4241
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.
4443
- `label`: str
4544
Unique identifier for the `patchworklib.Brick(s)` class object to be returned.
4645
If you want to adjust a layout composed of multiple bricks object using the label
4746
indexing method, providing the unique label name for returned object should be
4847
encouraged.
4948
- `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
5150
figure size of the given seaborn plot.
5251

5352
#### Returns
@@ -57,9 +56,9 @@
5756
- ### **`load_seaborngrid(g, label=None, labels=None, figsize=None)`**
5857

5958
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
6362
`patchworklib.Brick(s)` class objects.
6463

6564
#### Notes
@@ -70,14 +69,14 @@
7069

7170
- `g`: seaborn.axisgrid.xxGrid object
7271
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.
7473
- `label`: str
7574
Unique identifier for the `patchworklib.Brick(s)` class object to be returned.
7675
If you want to adjust a layout composed of multiple bricks object using the label
7776
indexing method, providing the unique label name for returned object should be
7877
encouraged.
7978
- `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
8180
figure size of the given seaborn plot.
8281

8382
#### Returns
@@ -86,7 +85,7 @@
8685

8786
- ### **`hstack(brick1, brick2, target=None, margin=None, direction='r', adjust_height=True, adjust_width=True, va='top')`**
8887

89-
Align two `patchworlib.Brick(s)` objects horizontally.
88+
Align two `patchworklib.Brick(s)` objects horizontally.
9089
When joining two Brick(s) objects by `"|"` or `"+"` operator, this function is called internally.
9190

9291
- `brick1 | brick2` is identical to `hstack(brick1, brick2)`
@@ -96,19 +95,19 @@
9695
#### Parameters
9796

9897
- `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.
10099
The location of this object is used as the base position for determining
101100
the `brick2` placement.
102101
- `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`
104103
(by default, on the right side) of the `brick1` object.
105104
- `target`: str, default: `None`
106105
Unique label name of the Brick or Brick(s) object that is a part of the `brick1`
107106
object. If you want to place `brick2` object next to the specific Brick(s) object
108107
in `brick1` object, please provide the `label` value of the Brick(s) object.
109108
- `margin`: float or str (`"none"`), default: `None`
110109
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.
112111
If the value is `"none"`, two Brick(s) objects will be joined with no margin
113112
(meaning that the axes spines will be joined so that they are fully glued together).
114113
- `direction`: str (`"r"` or `"l"`), default: `"r"`
@@ -120,15 +119,17 @@
120119
- `adjust_width`: bool, default: `True`
121120
If `True`, the width of `brick2` will be adjusted according to the aspect of `brick2`
122121
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`.
124123
- `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.
126125
If the value is `"top"`, `brick2` object will be aligned to the left/right top of `brick1` object.
127126
If the value is `"bottom"`, `brick2` object will be aligned to the left/right bottom of `brick1` object.
128127

129128
#### Returns
129+
130+
`patchworlib.Bricks` object
131+
130132

131-
`patchworklib.Bricks` object
132133

133134
- ### **`vstack(brick1, brick2, target=None, margin=None, direction='t', adjust_height=True, adjust_width=True, ha='l')`**
134135

@@ -176,7 +177,7 @@
176177

177178
`patchworlib.Bricks` object
178179

179-
- ### **`stack(bricks, margin=None, operator='|')`**
180+
- ### **`stack(bricks, margin=None, operator='|', equal_spacing=False)`**
180181

181182
Stack multiple Brick(s) objects horizontally or vetically.
182183

@@ -192,7 +193,11 @@
192193
Orientation of the arrangement for the given `patchworklib.Brick(s)` object.
193194
If this value is `|` or `/`, the width/height of the object to be stacked will be
194195
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+
196201
#### Returns
197202

198203
`patchworlib.Bricks` object
@@ -521,6 +526,23 @@ It can be joined with aother `patchworklib.Brick(s)` object by using `/`, `|`, `
521526
`matplotlib.spines.Spine` object
522527

523528

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.
524546

525547
- ### **`add_colorbar(self, cmap=None, x=None, y=None, vmin=0, vmax=1, hratio=None, wratio=None, coordinate='relative', **args)`**
526548

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If you want to use developmental version, it can be installed using the followin
1616

1717
#### 05152023: version 0.6.0 is released.
1818
- Bricks object gained the new methods `align_xlabels` and `align_ylabels`, which help users align x/y labels of the given Brick object.
19-
- The new argument equal_spacing was added to the stack function. If this value is set to True, axes bounding-boxes should be placed with equal spacing between them. Otherwise, depending on the text values of x/y tick labels and x/y labels, they may not always be equally spaced.
19+
- The new argument `equal_spacing` was added to the stack function. If this value is `True`, axes bounding-boxes should be placed with equal spacing between them. Otherwise, depending on the text values of x/y tick labels and x/y labels, they may not always be equally spaced.
2020
- Closed and maybe solved the issue ["Align labels of Bricks when subplot axes are aligned. #40"](https://github.com/ponnhide/patchworklib/issues/40)
2121
- Closed and maybe solved the issue ["Doesn't work with Plotnine Seaborn Theme. #37"](https://github.com/ponnhide/patchworklib/issues/37)
2222
- Closed and maybe solved the issue ["The position of the title cannot be set in plotnine. #36"](https://github.com/ponnhide/patchworklib/issues/36)

0 commit comments

Comments
 (0)