Open MarcSkovMadsen opened 2 years ago
Looking at the code here:
It seems to not be supported when y is a list or tuple, so making by making ´y´ a string "fixes" it.
A small note is there is no indication of overlap:
With alpha on:
Thanks @Hoxbro . I'm trying to move more into hvplot and understand the intention.
.hvplot
to be a drop in replacement for Pandas .plot
? Or is it "just" something with a similar api, where I should expect to have to adjust some of my code if I migrate from .plot
to .hvplot
?. What is the vision?by
does not work when y
is a list/tuple.For this example, it is harder to get the desired output. But try to make a scatter plot with your DataFrame with the index on the x-axis and age on the y-axis. With hvplot, it is as easy as df.hvplot.scatter(y="age")
. It is a bit harder to get it working with pandas.plot
I could get it to work with df.reset_index().plot.scatter(x="index", y="age")
.
If we then want to color the scatter based on gender, we can do it with: df.hvplot.scatter(y="age", c="gender")
or df.hvplot.scatter(y="age", by="gender")
. I couldn't find an easy way to do this with pandas.plot
(though there properly is a way to do it).
For the original question you can get the same output as pandas by using subplots: df.hvplot.hist(y="age", by="gender", subplots=True).cols(1)
.
I'm working on updating the docstrings for the
hist
plot. I would expect theby
argument to work similarly to how it works for other hvPlot plots and/ or similarly to how it works for Pandas plot https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.plot.hist.html.But it seems to have no effect.
With
by
Without
by