How to plot vertically stacked plot with same x-axis and - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How to plot vertically stacked plot with same x-axis and (/thread-19074.html) |
How to plot vertically stacked plot with same x-axis and - SriMekala - Jun-12-2019 Hi, I have below data: Inputdata.csv: Name Date y1 y2 y3 VAB 20190601 1 0 0 VAB 20190603 1 1 0 VLKA 20190604 0 0 1 MAKY 20190604 1 1 1 VAB 20190605 1 0 0 VAB 20190606 1 1 1 MAKY 20190609 0 1 1I want group by name and plot Date Vs. y1,y2,y2 (y1, y2, y3 are in vertically stacked) import pandas as pd input=r'D:\PythonCodes\Inputdata.csv' df=pd.read_csv(input) x=df['Date'] y1=df['y1'] y2=df['y2'] y3=df['y3'] fig, axs = plt.subplots(3, sharex=True, sharey=True) fig.suptitle('Sharing both axes') axs[0].plot(x, y1) axs[1].plot(x, y2, 'o') axs[2].plot(x, y3, '+')But I want to group the chart automatically based on "Name", and plot in vertically stacked plots. |