Conversation
MATPLOTLIB_TRANSFORMS
| 'bar_width': UNSET, | ||
| 'size': lambda k, v: ('s', v), | ||
| 'fill_color': lambda k, v: ('facecolor', v), | ||
| 'fill_color': lambda k, v: ('facecolors', v), |
There was a problem hiding this comment.
Could you please demonstrate with an example the effect of this change? I think that HoloViews accepts either facecolor or facecolors as a style option for the Matplotlib backend, depending on the element type (e.g. https://github.com/holoviz/holoviews/blob/e6024ccc0c04e1b8678b76467491cf85c68a9aee/holoviews/plotting/mpl/chart.py#L215 and https://github.com/holoviz/holoviews/blob/e6024ccc0c04e1b8678b76467491cf85c68a9aee/holoviews/plotting/mpl/chart.py#L589). So we need to make sure what we map to exactly. And maybe, given the current mapping structure, it might not always be possible to map from a bokeh option to a mpl one if there are this kind of differences.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
Let me update the example based on #1378:
import hvplot.xarray
import holoviews
import xarray
from hvplot.backend_transforms import MATPLOTLIB_TRANSFORMS
hvplot.extension("bokeh", "matplotlib", compatibility="bokeh")
data = xarray.DataArray([0, 1, 2])
data.name="Needs a name"
hvplot.output(backend="matplotlib")
## Uncomment to see it fixed
# MATPLOTLIB_TRANSFORMS["style"]["fill_color"] = lambda k, v: ('facecolors', v)
overlay = holoviews.Overlay()
curve_line = data.hvplot(kind="line")
overlay *= curve_line
curve_scatter = data.hvplot(kind="scatter", fill_color="red", size=5000)
overlay *= curve_scatter
overlayThere was a problem hiding this comment.
To illustrate what I mean with the complexity to map from a backend to another.
global_option_tree = hv.Store.options(backend='bokeh')
fill_color = []
for element, option_tree in global_option_tree.items():
element = element[0]
style_opts = option_tree.groups['style']
allowed_styles = style_opts.allowed_keywords
if 'fill_color' in allowed_styles:
fill_color.append(str(element))
print('Bokeh')
print(f'fill_color: {sorted(fill_color)}')
print()
global_option_tree = hv.Store.options(backend='matplotlib')
facecolors = []
facecolor = []
for element, option_tree in global_option_tree.items():
element = element[0]
style_opts = option_tree.groups['style']
allowed_styles = style_opts.allowed_keywords
if 'facecolor' in allowed_styles:
facecolor.append(str(element))
if 'facecolors' in allowed_styles:
facecolors.append(str(element))
print('Matplotlib')
print(f'facecolor: {sorted(facecolor)}')
print(f'facecolors: {sorted(facecolors)}')Bokeh
fill_color: ['Area', 'Bars', 'Bivariate', 'Distribution', 'HSpan', 'HSpans', 'HeatMap', 'HexTiles', 'Histogram', 'Nodes', 'Points', 'Polygons', 'QuadMesh', 'Rectangles', 'Scatter', 'Spread', 'VSpan', 'VSpans']
Matplotlib
facecolor: ['Area', 'Bars', 'Bivariate', 'Distribution', 'HLines', 'HSpan', 'HSpans', 'Histogram', 'Polygons', 'Rectangles', 'Spread', 'VLines', 'VSpan', 'VSpans']
facecolors: ['Nodes', 'Points', 'Scatter', 'Scatter3D', 'Surface', 'VectorField', 'Violin']
So this is likely not a type, and needs more investigation to see whether changing it as suggested in the PR is worth it (i.e. another class of users happy with the current behavior may be unhappy with the new one).
I was using these transforms manually (because I've had other issues with
hvplot.extension(compatibility)not working) and I've encountered, at least one typo/renamed option. I did not look into other ones if there are more typos there.I have encountered a few other issues that could be addressed here:
markerscompatibility. Reference 1 2sizeis inconsistent, I am multiplying by20and seems alright?