Skip to content

Commit

Permalink
add optional ref_std_line
Browse files Browse the repository at this point in the history
  • Loading branch information
coxipi committed Jun 14, 2024
1 parent ee15980 commit 537cc03
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/figanos/matplotlib/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1824,6 +1824,7 @@ def taylordiagram(
std_range: tuple = (0, 1.5),
contours: int | None = 4,
contours_kw: dict[str, Any] | None = None,
ref_std_line: bool = False,
legend_kw: dict[str, Any] | None = None,
std_label: str | None = None,
corr_label: str | None = None,
Expand All @@ -1850,6 +1851,8 @@ def taylordiagram(
Number of rsme contours to plot.
contours_kw : dict, optional
Arguments to pass to `plt.contour()` for the rmse contours.
ref_std_line : bool, optional
If True, draws a circular line on radius `std = ref_std`. Default: False
legend_kw : dict, optional
Arguments to pass to `plt.legend()`.
std_label : str, optional
Expand Down Expand Up @@ -2047,6 +2050,18 @@ def taylordiagram(

points = [ref_pt] # set up for later

# plot a circular line along `ref_std`
if ref_std_line:
angles_for_line = np.linspace(0, np.pi / 2, 100)
radii_for_line = np.full_like(angles_for_line, ref_std)
ax.plot(
angles_for_line,
radii_for_line,
color=ref_kw["color"],
linewidth=0.5,
linestyle="--",
)

# rmse contours from reference standard deviation
if contours:
radii, angles = np.meshgrid(
Expand Down

0 comments on commit 537cc03

Please sign in to comment.