Plotting on a large number of facets
Plotting on a large number of facets
I want to make a plot similar to the one that appears on the seaborn page: https://seaborn.pydata.org/examples/many_facets.html.
index state_name totalprod
0 28 North Dakota 475085000.0
1 3 California 347535000.0
2 34 South Dakota 266141000.0
3 5 Florida 247048000.0
4 21 Montana 156562000.0
To see the variation during the period in a graph initially, and then get the percentages. I'm trying the following,
grid = sns.FacetGrid(df_bystate, col="state_name", palette="tab20c", col_wrap=4)
grid.map(plt.axhline, y=0, ls=":")
grid.map(plt.plot, [("year", "totalprod")], marker="o")
grid.set(xticks=np.arange(5), yticks=[-5, 5], xlim=(-10, 10), ylim=(-5.5, 5.5))
I get the following error:
ValueError: Buffer has wrong number of dimensions (expected 1, got 3)
But the graphics are not generated with the data that supposed. I'm new to this and I do not know what I'm doing wrong, so I ask for your patience.
Thanks!!
From the docs: the
data
argument is supposed to be - Tidy ("long-form") dataframe where each column is a variable and each row is an observation.
does that sound like your data?– wwii
Sep 12 '18 at 19:07
data
Tidy ("long-form") dataframe where each column is a variable and each row is an observation.
Yes it is. Each column represents a variable and the rows are observations
– Oscar Silveiro
Sep 12 '18 at 19:22
0
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Please do not post images of code or data: copy the data, paste it into the question, and format it as code. ...You should not post code as an image because:...
– wwii
Sep 12 '18 at 18:56