Skip to content
Advertisement

plot multiple pandas dataframes in one graph

I have created 6 different dataframes that eliminate the outliers of their own original data frames. Now, I’m trying to plot all of the dataframes that eliminate the outliers on the same graph.

This is my code that eliminates the outliers in each data frame:

JavaScript

If I remove the comment newdf.plot() I will be able to plot all of the graphs separately but I want them all on one graph.

And yes, I’ve already read over http://matplotlib.org/examples/pylab_examples/subplots_demo.html but that link doesn’t have any examples with multiple plots in one chart.

I have also read this: http://pandas-docs.github.io/pandas-docs-travis/visualization.html which has some really great information but the examples that have multiple plots in one graph use the same data frame. I have 6 separate dataframes. I’ve thought of one solution to my problem would be to write all of the dataframes to the same excel file then plot them from excel, but that seems excessive and I don’t need this data to be saved to an excel file.

My question is this: How can I plot multiple pandas dataframes in the same graph.

My graph after following Scott’s advice enter image description here

enter image description here

What the graph should more or less look like

Advertisement

Answer

Am I missing something? Normally, I just do this for multiple dataframes:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement