Skip to content

Commit

Permalink
Merge pull request #45 from Pennycook/marker-limit
Browse files Browse the repository at this point in the history
Raise exception if # applications > # markers
  • Loading branch information
Pennycook committed Apr 26, 2024
2 parents 76b269b + da4146d commit 68ae4d1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions p3/plot/backend/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ def __init__(
markers = app_style.markers
if not isinstance(markers, (list, tuple)):
raise ValueError("Unsupported type provided for app_markers")
if len(applications) > len(markers):
raise RuntimeError(
f"The number of applications ({len(applications)}) is greater "
f"than the number of markers ({len(markers)}). "
+ "Please adjust the ApplicationStyle.",
)
app_markers = {app: color for app, color in zip(applications, markers)}

# Choose colors for each platform
Expand Down Expand Up @@ -566,6 +572,12 @@ def __init__(
markers = style.markers
if not isinstance(markers, (list, tuple)):
raise ValueError("Unsupported type provided for app_markers")
if len(applications) > len(markers):
raise RuntimeError(
f"The number of applications ({len(applications)}) is greater "
f"than the number of markers ({len(markers)}). "
+ "Please adjust the ApplicationStyle.",
)
app_markers = {
app: marker for app, marker in zip(applications, markers)
}
Expand Down

0 comments on commit 68ae4d1

Please sign in to comment.