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

compat: Matplotlib 3.10.1 #6526

Merged
merged 3 commits into from
Mar 3, 2025
Merged

compat: Matplotlib 3.10.1 #6526

merged 3 commits into from
Mar 3, 2025

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Feb 28, 2025

The failing tests because of the updated UserWarning:

FAILED holoviews/tests/plotting/matplotlib/test_graphplot.py::TestMplGraphPlot::test_graph_op_node_color_linear - holoviews.core.options.AbbreviatedException: UserWarning: You passed both c and facecolor/facecolors for the markers. c has precedence over facecolor/facecolors. This behavior may change in the future.
FAILED holoviews/tests/plotting/matplotlib/test_graphplot.py::TestMplGraphPlot::test_graph_op_node_color_categorical - holoviews.core.options.AbbreviatedException: UserWarning: You passed both c and facecolor/facecolors for the markers. c has precedence over facecolor/facecolors. This behavior may change in the future.
FAILED holoviews/tests/plotting/matplotlib/test_graphplot.py::TestMplGraphPlot::test_graph_op_node_color_linear_update - holoviews.core.options.AbbreviatedException: UserWarning: You passed both c and facecolor/facecolors for the markers. c has precedence over facecolor/facecolors. This behavior may change in the future.
FAILED holoviews/tests/plotting/matplotlib/test_graphplot.py::TestMplGraphPlot::test_plot_graph_numerically_colored_nodes - holoviews.core.options.AbbreviatedException: UserWarning: You passed both c and facecolor/facecolors for the markers. c has precedence over facecolor/facecolors. This behavior may change in the future.
FAILED holoviews/tests/plotting/matplotlib/test_graphplot.py::TestMplChordPlot::test_chord_node_color_linear_style_mapping_update - holoviews.core.options.AbbreviatedException: UserWarning: You passed both c and facecolor/facecolors for the markers. c has precedence over facecolor/facecolors. This behavior may change in the future.
FAILED holoviews/tests/plotting/matplotlib/test_graphplot.py::TestMplChordPlot::test_chord_node_color_style_mapping - holoviews.core.options.AbbreviatedException: UserWarning: You passed both c and facecolor/facecolors for the markers. c has precedence over facecolor/facecolors. This behavior may change in the future.
FAILED holoviews/tests/plotting/matplotlib/test_graphplot.py::TestMplTriMeshPlot::test_trimesh_op_node_color_categorical - holoviews.core.options.AbbreviatedException: UserWarning: You passed both c and facecolor/facecolors for the markers. c has precedence over facecolor/facecolors. This behavior may change in the future.
FAILED holoviews/tests/plotting/matplotlib/test_graphplot.py::TestMplTriMeshPlot::test_trimesh_op_node_color_linear - holoviews.core.options.AbbreviatedException: UserWarning: You passed both c and facecolor/facecolors for the markers. c has precedence over facecolor/facecolors. This behavior may change in the future.

As far as I can see, we have relied on the behavior of c taking precedence over facecolor/facecolors, so here we just remove the values from the node options.

# Matplotlib 3.10.1 started emitting this UserWarning:
# You passed both c and facecolor/facecolors for the markers.
# c has precedence over facecolor/facecolors.
if MPL_GE_3_10_1 and "c" in node_opts:
Copy link
Member Author

@hoxbro hoxbro Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the MPL check here, but I'm not 100%, so I added it.

We could also use MPL_GE_3_10_0, as this has been tested, but could cause confusion...

@hoxbro hoxbro requested a review from maximlt February 28, 2025 08:53
Copy link

codecov bot commented Feb 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.79%. Comparing base (0ba7398) to head (819020b).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6526      +/-   ##
==========================================
+ Coverage   88.22%   88.79%   +0.57%     
==========================================
  Files         323      323              
  Lines       68946    68949       +3     
==========================================
+ Hits        60829    61225     +396     
+ Misses       8117     7724     -393     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hoxbro hoxbro added the backport PRs which are to land in a hotfix release label Feb 28, 2025
@hoxbro hoxbro marked this pull request as ready for review March 1, 2025 06:53
Copy link
Member

@maximlt maximlt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In which context is this warning triggered when using HoloViews? Is it when plotting some built-in elements?

Ignore this, I missed the first message. Unless there's a way to modify the plot objects that generate this error, I guess it's okay. Just to be sure, it does mean that users who pass c and facecolor together via .opts() won't get the warning, right?

@hoxbro
Copy link
Member Author

hoxbro commented Mar 3, 2025

A MRE is:

import holoviews as hv

hv.extension()

edges = [(0, 1)]
nodes = hv.Nodes([(0, 0, 0, 0.5), (0, 1, 1, 1.5)], vdims="color")
graph = hv.Graph((edges, nodes)).opts(node_color="color")
graph

Where facecolors is set here:

options.Graph = Options('style', node_edgecolors='black', node_facecolors=Cycle(),

So it is because the default argument conflicts with node_color set by users.

@hoxbro hoxbro merged commit 2465ad1 into main Mar 3, 2025
14 checks passed
@hoxbro hoxbro deleted the compat_mpl_3_10_1 branch March 3, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport PRs which are to land in a hotfix release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants