Graph using functionals with long data instead of wide?

Screen Link: https://app.dataquest.io/m/276/scatter-plots-for-exploratory-analysis/5/write-a-function-to-create-multiple-scatter-plots

In the examples in the visualization mission, the data used for the y variable (and subsequently the different graphs) is in wide format, so each y variable is its own column. Is it possible to use the graphing functional if there is only one y column with multiple values (i.e. column name = “movie_site” and then the column values include “Fandango”, “IMDB” etc) and then a separate column for the actual rating values?

Seaborn can indeed deal with categoricals in long format with hue parameter sns.relplot(x="total_bill", y="tip", hue="smoker", data=tips);. I find this a great advantage of seaborn over matplotlib: https://seaborn.pydata.org/tutorial/relational.html.

Wide format is just more suitable for doing things like df.plot directly.
Any reason you want to plot from long format?
Long format is usually the more raw form, and through analysis, the long format would be pivoted into wide.

1 Like