How to use lineplot with numpy array
See original GitHub issueRelated to this StackOverflow question, I’m confused about how to replace the error-bar functionality of tsplot
. Previously, it was possible to make a time-series plot with confidence interval shading using:
x = np.linspace(0, 15, 31)
data = np.sin(x) + np.random.rand(10, 31) + np.random.randn(10, 1)
sns.tsplot(data)
How do I replace this with sns.linplot
call? When I try sns.lineplot(data=data)
it tells me ValueError: These
style levels are missing dashes: {6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30}
.
I tried looking at the code to see if I could make the fix myself, but it seems almost as if what I’m trying to do is a bad idea. Is Seaborn not intended to satisfy this case? Is the key to manipulate the data into a DataFrame? Is there any way I can discuss the design of plotting time-series with you or has the window for this discussion passed?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
The equivalent would be to make a long-form pandas dataframe:
lineplot
has some support for wide form data, but like other modern seaborn functions it’s limited in what it can do with it.Previously, you would be able to type:
to generate something that looks like:
Now, as I understand it, I have to use pandas to melt my array and then perform various shifts/corrections in order to be able to use this plot with something else.
Or: