user220822
user220822

Reputation: 3

How to plot multiple CSV files as a boxplot on the same plot

I have 13 different saved CSV files in a folder and each file contains just one column of data (i previously saved these separately from a larger dataset using python having calculated what I needed to), I would like to plot each of these files as 13 different boxplots on the same plot.

I am quite new to python and I'm familiar with matplotlib, so far I know how to plot each of these files individually but of course, I would like them to be plotted next to each other so I can better compare and visualise my data. here are two of my plots: usingplt.boxplot(af,meanline=True,showmeans=True)

boxplot1 boxplot2

this is how I named/saved my files (just 2 of them here)

af=numpy.loadtxt(fname='af_river.csv.')
am=numpy.loadtxt(fname='am_river.csv.')

but I don't know where to go from here, do I/is there a way to create a loop which goes through each of these files separately and plots them next to each other?

Upvotes: 0

Views: 1480

Answers (1)

Julkar9
Julkar9

Reputation: 2110

Try this

plt.boxplot([af,am],meanline=True,showmeans=True)  

This will plot all the files in the same plot

Upvotes: 2

Related Questions