Skip to content

Commit

Permalink
Fix mcolor arg (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
LSYS committed Jan 14, 2024
1 parent 17c7dcc commit b903bd1
Show file tree
Hide file tree
Showing 5 changed files with 437 additions and 184 deletions.
Binary file modified docs/images/group-grouporder-pvalue-sort-colorrows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/multimodel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
461 changes: 354 additions & 107 deletions examples/readme-examples.ipynb

Large diffs are not rendered by default.

147 changes: 74 additions & 73 deletions examples/test-multmodel-sleep.ipynb

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions forestplot/mplot_graph_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
from typing import Any, List, Optional, Sequence, Tuple, Union

import matplotlib.pyplot as plt
Expand Down Expand Up @@ -158,7 +159,7 @@ def mdraw_est_markers(
_df = dataframe.query(f'{model_col}=="{modelgroup}"')
base_y_vector = np.arange(len(_df)) - offset / 2 - (offset / 2) * (n - 2)
_y = base_y_vector + (ix * offset)
ax.scatter(y=_y, x=_df[estimate], marker=msymbols[ix], color=mcolor[ix], s=markersize)
ax.scatter(y=_y, x=_df[estimate], marker=msymbols[ix], c=mcolor[ix], s=markersize)
return ax


Expand Down Expand Up @@ -280,9 +281,13 @@ def mdraw_legend(
leg_markersize = kwargs.get("leg_markersize", 8)
leg_artists = []
for ix, symbol in enumerate(msymbols):
leg_artists.append(
Line2D([0], [0], marker=symbol, color=mcolor[ix], markersize=leg_markersize)
)
try:
leg_artists.append(
Line2D([0], [0], marker=symbol, color=mcolor[ix], markersize=leg_markersize)
)
except IndexError:
warnings.warn("'msymbols' and 'mcolor' have different lengths.")
pass
# Handle position of legend
# bbox_to_anchor = kwargs.get("bbox_to_anchor", None)
if len(modellabels) <= 2:
Expand Down

0 comments on commit b903bd1

Please sign in to comment.