Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions modelskill/_rose.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ def _create_patch(
colors.append(cmap(norm(mag)))

p = PatchCollection(
np.flip(patches),
facecolors=np.flip(colors, axis=0),
list(reversed(patches)),
facecolors=list(reversed(colors)),
edgecolor="k",
linewidth=0.5,
)
Expand Down Expand Up @@ -458,18 +458,23 @@ def _add_legend_to_ax(

handles = [Rectangle((0, 0), 1, 1, color=c, ec="k") for c in colors]
handles[0].set_color("white")
handles[0].set_ec("k")
handles[0].set_ec("k") # type: ignore

if primary:
bbox_to_anchor: Tuple[float, ...] = (1.05, -0.06, 0.1, 0.8)
bbox_to_anchor = (
1.05,
-0.06,
0.1,
0.8,
) # type: ignore
loc = "lower left"
else:
bbox_to_anchor = (-0.13, -0.06, 0.1, 0.8)
loc = "lower right"

# TODO figure out how to make this work properly
if not dual:
bbox_to_anchor = (-0.05, 0.0)
bbox_to_anchor = (-0.05, 0.0) # type: ignore
loc = "lower right"

leg = Legend(
Expand Down Expand Up @@ -503,7 +508,7 @@ def _add_watermark_to_ax(ax, watermark: str) -> None:
ax.add_artist(text)


def _get_cmap(cmap: Union[str, mpl.colors.ListedColormap]) -> mpl.colors.ListedColormap:
def _get_cmap(cmap: Union[str, mpl.colors.ListedColormap]):
if isinstance(cmap, str):
return mpl.colormaps[cmap]
elif isinstance(cmap, mpl.colors.ListedColormap):
Expand Down
2 changes: 1 addition & 1 deletion modelskill/comparison/_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def _area_is_polygon(area) -> bool:
return True


def _inside_polygon(polygon, xy) -> bool:
def _inside_polygon(polygon, xy):
import matplotlib.path as mp # type: ignore

if polygon.ndim == 1:
Expand Down