Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portrait plot annotate text color #999

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Changes from 1 commit
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
Next Next commit
add annotate_text_colors parameter
  • Loading branch information
lee1043 committed Nov 8, 2023
commit 3b4959d64d1edc0332b99af591033dc3ae660a74
3 changes: 3 additions & 0 deletions pcmdi_metrics/graphics/portrait_plot/portrait_plot_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def portrait_plot(
ax=None,
annotate=False,
annotate_data=None,
annotate_textcolors=("black", "white"),
annotate_fontsize=15,
annotate_format="{x:.2f}",
figsize=(12, 10),
Expand Down Expand Up @@ -61,6 +62,7 @@ def portrait_plot(
- `annotate`: bool, default=False, add annotating text if true,
but work only for heatmap style map (i.e., no triangles)
- `annotate_data`: 2d numpy array, default=None. If None, the image's data is used. Optional.
- `annotate_textcolors`: Tuple. A pair of colors for annotation text. Default is ("black", "white")
- `annotate_fontsize`: number (int/float), default=15. Font size for annotation
- `annotate_format`: format for annotate value, default="{x:.2f}"
- `figsize`: tuple of two numbers (width, height), default=(12, 10), figure size in inches
Expand Down Expand Up @@ -175,6 +177,7 @@ def portrait_plot(
data=data,
annotate_data=annotate_data,
valfmt=annotate_format,
textcolors=annotate_textcolors,
threshold=(2, -2),
fontsize=annotate_fontsize,
)
Expand Down