hvplot icon indicating copy to clipboard operation
hvplot copied to clipboard

hvplot should add markers to a line plot when a marker type is supplied

Open rjp23 opened this issue 6 years ago • 13 comments

In pandas "marker" or "style" control the plot symbols

e.g. df.loc['a'].plot(marker='o')

but with hvplot:

df.loc['a'].hvplot(marker='o')

gives

WARNING:root:main: marker option not found for line plot; similar options include: []

rjp23 avatar Feb 19 '19 13:02 rjp23

It sounds like the Pandas .plot api is inferring that if you set a marker shape you want a points and not the default of a line plot? Or does Pandas plot a line and also add markers to it in this case?

jbednar avatar Feb 19 '19 21:02 jbednar

Yep, the latter. It'll plot points along the line in Pandas.

rjp23 avatar Feb 19 '19 21:02 rjp23

Ok, I'll change the issue title then.

jbednar avatar Feb 19 '19 21:02 jbednar

Sorry? The title's correct isn't it? Or should it be more descriptive?

rjp23 avatar Feb 19 '19 22:02 rjp23

It was correct, I just made it more specific about the desired behavior.

jbednar avatar Feb 19 '19 22:02 jbednar

I guess it's not just adding the markers, the the whole styling of the plots (changing the colour, changing the marker type, changing the linestyle, using the style keyword, etc)

rjp23 avatar Feb 19 '19 22:02 rjp23

The difference is really in matplotlib since the default plot call plots lines but also supports markers. I do agree that we should emulate this behavior in hvplot though.

philippjfr avatar Feb 20 '19 03:02 philippjfr

Should hvplot be generating an overlay of line and a blank marker, by default, to support this behavior?

jbednar avatar Feb 20 '19 14:02 jbednar

Should hvplot be generating an overlay of line and a blank marker, by default, to support this behavior?

Seems inefficient and pretty pointless.

philippjfr avatar Feb 20 '19 14:02 philippjfr

Just wondering how to support it efficiently without adding a lot of complexity, then.

jbednar avatar Feb 20 '19 14:02 jbednar

I've been looking for this feature, I guess that it's not been implemented yet (? correct me pls). There is quite a big difference in a way how matplotlib treats plot() and scatter() on interactive plots. The first one is much more memory-friendly. It would be great to have in in hvplot, however the hoovering would be useless then (since plot() result is single object, and not many points)

DanielRudnicki avatar Feb 13 '20 08:02 DanielRudnicki

@holoviz/triaging-team This is a clear obstacle for new users so I think we should support this. Any other opinions out there?

philippjfr avatar Jun 22 '20 16:06 philippjfr

I agree hvPlot should support that. I assume it doesn't make sense to add support to that to HoloViews that provides more 'atomic' elements compared to hvPlot.

I suggest adding basic support to markers to df.hvplot.line, supporting marker ('o', etc.), markersize and markercolor. Internally it would return an overlay of Curve and Scatter. For more more (e.g. not having a marker every point) I suggest documenting how to do that by creating the overlay explicitly.

maximlt avatar Oct 11 '22 09:10 maximlt