Skip to content

Commit

Permalink
Fixing merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
LSYS committed Jan 21, 2024
2 parents adcc9bc + bee1af9 commit 4d8396a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion forestplot/graph_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Holds functions to draw the plot."""
import warnings
from typing import Any, Optional, Sequence, Tuple, Union
from typing import Any, List, Optional, Sequence, Tuple, Union

import matplotlib.pyplot as plt
import pandas as pd
Expand Down Expand Up @@ -544,6 +544,7 @@ def format_xticks(
hl: str,
xticks: Optional[Union[list, range]],
ax: Axes,
xlim: Optional[Union[Tuple, List]] = None,
**kwargs: Any
) -> Axes:
"""
Expand Down Expand Up @@ -596,6 +597,8 @@ def format_xticks(
ax.set_xticklabels(xticklabels)
for xticklab in ax.get_xticklabels():
xticklab.set_fontfamily("sans-serif")
if xlim:
ax.set_xlim(xlim[0], xlim[1])
return ax


Expand Down
13 changes: 12 additions & 1 deletion forestplot/mplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def mforestplot(
preprocess: bool = True,
table: bool = False,
legend: bool = True,
xlim: Optional[Union[Tuple, List]] = None,
**kwargs: Any,
) -> Axes:
"""
Expand Down Expand Up @@ -199,6 +200,7 @@ def mforestplot(
color_alt_rows=color_alt_rows,
table=table,
legend=legend,
xlim=xlim,
**kwargs,
)
if return_df:
Expand Down Expand Up @@ -312,6 +314,7 @@ def _make_mforestplot(
color_alt_rows: bool = False,
table: bool = False,
legend: bool = True,
xlim: Optional[Union[Tuple, List]] = None,
**kwargs: Any,
) -> Axes:
if models is None:
Expand Down Expand Up @@ -348,7 +351,14 @@ def _make_mforestplot(
)

format_xticks(
dataframe=dataframe, estimate=estimate, ll=ll, hl=hl, xticks=xticks, ax=ax, **kwargs
dataframe=dataframe,
estimate=estimate,
ll=ll,
hl=hl,
xticks=xticks,
xlim=xlim,
ax=ax,
**kwargs,
)
mdraw_ref_xline(
ax=ax,
Expand Down Expand Up @@ -410,4 +420,5 @@ def _make_mforestplot(
negative_padding = 0.5
ax.set_ylim(-0.5, ax.get_ylim()[1] - negative_padding)
despineplot(despine=despine, ax=ax)

return ax

0 comments on commit 4d8396a

Please sign in to comment.