Skip to content

Commit 55c76f1

Browse files
authored
Merge pull request #85 from LSYS/patch
* Fixes #82 * Fixes #74
2 parents b0f508f + 056c256 commit 55c76f1

4 files changed

Lines changed: 18 additions & 9 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@ plt.savefig("plot.png", bbox_inches="tight")
136136
```python
137137
fp.forestplot(df, # the dataframe with results data
138138
estimate="r", # col containing estimated effect size
139-
moerror="moerror", # columns containing conf. int. margin of error
139+
ll="ll", hl="hl", # columns containing conf. int. lower and higher limits
140140
varlabel="label", # column containing variable label
141141
capitalize="capitalize", # Capitalize labels
142142
groupvar="group", # Add variable groupings
143143
# group ordering
144144
group_order=["labor factors", "occupation", "age", "health factors",
145145
"family factors", "area of residence", "other factors"],
146-
sort=True, # sort in ascending order (sorts within group if group is specified)
146+
sort=True # sort in ascending order (sorts within group if group is specified)
147147
)
148148
```
149149
<p align="left"><img width="75%" src="https://raw.githubusercontent.com/LSYS/forestplot/main/docs/images/group-grouporder-sort.png"></p>

forestplot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""State version and import user-facing functions."""
2-
VERSION = (0, 3, 0)
2+
VERSION = (0, 3, 2)
33

44
__version__ = ".".join(map(str, VERSION))
55

forestplot/graph_utils.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,16 @@ def right_flush_yticklabels(
175175
dataframe[yticklabel], fontfamily=fontfamily, fontsize=fontsize, ha="right"
176176
)
177177
yax = ax.get_yaxis()
178-
pad = max(
179-
T.label.get_window_extent(renderer=fig.canvas.get_renderer()).width
180-
for T in yax.majorTicks
181-
)
178+
try:
179+
pad = max(
180+
T.label.get_window_extent(renderer=fig.canvas.get_renderer()).width
181+
for T in yax.majorTicks
182+
)
183+
except AttributeError:
184+
pad = max(
185+
T.label1.get_window_extent(renderer=fig.canvas.get_renderer()).width
186+
for T in yax.majorTicks
187+
)
182188
if flush:
183189
yax.set_tick_params(pad=pad)
184190

@@ -683,7 +689,10 @@ def draw_tablelines(
683689
Matplotlib Axes object.
684690
"""
685691
first_yticklab = ax.get_yaxis().majorTicks[-1]
686-
bbox_disp = first_yticklab.label.get_window_extent()
692+
try:
693+
bbox_disp = first_yticklab.label.get_window_extent()
694+
except AttributeError:
695+
bbox_disp = first_yticklab.label1.get_window_extent()
687696
(x0, _), (x1, _) = ax.transData.inverted().transform(bbox_disp)
688697
upper_lw, lower_lw = 2, 1.3
689698
nrows = len(dataframe)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
install_requires = ["pandas", "numpy", "matplotlib", "matplotlib-inline<=0.1.3"]
1111
setup(
1212
name="forestplot",
13-
version="0.3.0",
13+
version="0.3.2",
1414
license="MIT",
1515
author="Lucas Shen",
1616
author_email="lucas@lucasshen.com",

0 commit comments

Comments
 (0)