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

Style option "s" does not behave the same as "size" with hv.dim #1449

Open
1 task
Lnk2past opened this issue Oct 25, 2024 · 1 comment
Open
1 task

Style option "s" does not behave the same as "size" with hv.dim #1449

Lnk2past opened this issue Oct 25, 2024 · 1 comment

Comments

@Lnk2past
Copy link

Lnk2past commented Oct 25, 2024

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc should be added within the dropdown below.)

Software Version Info
python      3.11.10
bokeh       3.5.2
holoviews   1.19.1
hvplot      0.11.0
matplotlib  3.9.2
plotly      5.24.1

Description of expected behavior and the observed behavior

According to the docs, the styling option s is documented as:

s : int, optional, also available as 'size'
    The size of the marker

But this is not true, as s and size are treated differently, at least for scatter and points plots. This becomes clear when trying to use a dim transform for the size. Granted, it does say int for the type, but given that this seems to work partially for some configurations, maybe this should be clarified/updated.

Complete, minimal, self-contained example code that reproduces the issue

import holoviews as hv
import hvplot
import hvplot.pandas
import numpy as np
import pandas as pd

x = np.linspace(0.0, 10.0, 25)
y = np.sin(x)
df = pd.DataFrame({'x': x, 'y': y})

size_opts = dict(kind='scatter', size=hv.dim('y') * 50.0)
s_opts = dict(kind='scatter', s=hv.dim('y') * 50.0)

# run each of these in a separate cell in a notebook to see the errors and differences

# bokeh: size works, s does not work
# also, when s does not work, other hv.dim cannot be used and an warning is emitted (not thoroughly tested)
hvplot.extension("bokeh")
(df.hvplot('x', 'y', **size_opts) + df.hvplot('x', 'y', **s_opts)).cols(1)

# matplotlib: size does not work, s works
hvplot.extension("matplotlib")
(df.hvplot('x', 'y', **size_opts) + df.hvplot('x', 'y', **s_opts)).cols(1)

# plotly: size does not work at all and errors, s does not work
hvplot.extension("plotly")
df.hvplot('x', 'y', **size_opts)
df.hvplot('x', 'y', **s_opts)

Stack traceback and/or browser JavaScript console output

Screenshots or screencasts of the bug in action

image

image

image

  • I may be interested in making a pull request to address this
@Lnk2past
Copy link
Author

Possibly related to 674

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant