Python Forum
How to plot vertically stacked plot with same x-axis and
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to plot vertically stacked plot with same x-axis and
#1
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 1
I 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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Value Error when Trying to Plot Filtered Waveforms mkohler 1 2,012 May-09-2024, 05:33 PM
Last Post: deanhystad
  Plot several graphs in one plot Ferdiss 1 1,266 Apr-11-2024, 08:37 PM
Last Post: deanhystad
  Plot function Sedos101 3 2,402 Aug-23-2023, 02:53 PM
Last Post: deanhystad
  Likert survey data plot error Andrzej_Andrzej 6 4,442 Jul-16-2023, 10:11 PM
Last Post: deanhystad
  Error when animating 3D plot Tee 4 3,140 Jul-03-2023, 08:49 PM
Last Post: Tee
  Plot multiple 2D Curves in 3D stc 5 3,904 Jun-11-2023, 05:48 PM
Last Post: snippsat
  Plot a pandas data fram via pyqtgraph with an modul import and qt designer widget Nietzsche 0 1,989 May-29-2023, 02:42 PM
Last Post: Nietzsche
  first time use plot - I get empty graph korenron 6 6,022 Feb-04-2023, 02:14 PM
Last Post: deanhystad
  Create simple live plot of stock data dram 2 4,512 Jan-27-2023, 04:34 AM
Last Post: CucumberNox
Thumbs Up Python 3 Jupyter notebook ternary plot data nicholas 0 2,432 Jan-21-2023, 05:01 PM
Last Post: nicholas

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.