-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Troubleshooting workflow error (#87) Pytest showing nan==nan as error for py3.9 and py3.10. * Add branch to workflow (#88) * Testing make_multimodel_tableheaders (#88) * Add test_make_multimodel_tableheaders (#88) * Pleasing linters (#88) * Add docstring & test for (#88, #89) * Fix compatibility with newer mpl versions (#82) * Pleasing linters * Pleasing linters
- Loading branch information
Showing
2 changed files
with
86 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import matplotlib.pyplot as plt | ||
import pandas as pd | ||
from matplotlib.pyplot import Axes | ||
|
||
from forestplot.mplot_graph_utils import mdraw_ref_xline, mdraw_yticklabels | ||
|
||
x, y = [0, 1, 2], [0, 1, 2] | ||
str_vector = ["a", "b", "c"] | ||
input_df = pd.DataFrame( | ||
{ | ||
"yticklabel": str_vector, | ||
"estimate": x, | ||
"moerror": y, | ||
"ll": x, | ||
"hl": y, | ||
"pval": y, | ||
"formatted_pval": y, | ||
"yticklabel1": str_vector, | ||
"yticklabel2": str_vector, | ||
} | ||
) | ||
|
||
|
||
def test_mdraw_ref_xline(): | ||
_, ax = plt.subplots() | ||
ax = mdraw_ref_xline( | ||
ax, | ||
dataframe=input_df, | ||
model_col="yticklabel", | ||
annoteheaders=None, | ||
right_annoteheaders=None, | ||
) | ||
assert isinstance(ax, Axes) | ||
|
||
|
||
def test_mdraw_yticklabels(): | ||
# Prepare the input DataFrame | ||
str_vector = ["a", "b", "c"] | ||
input_df = pd.DataFrame( | ||
{ | ||
"yticklabel": str_vector, | ||
} | ||
) | ||
|
||
# Create a matplotlib Axes object | ||
_, ax = plt.subplots() | ||
|
||
# Call the function | ||
ax = mdraw_yticklabels(input_df, yticklabel="yticklabel", flush=True, ax=ax) | ||
|
||
assert isinstance(ax, Axes) | ||
assert [label.get_text() for label in ax.get_yticklabels()] == str_vector |