Python Forum
Creating Plots & Sharing X Axis
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating Plots & Sharing X Axis
#1
Hello all

I am trying to create a plot in matplotlib where I have 2 x data sets, Data Set 1 which has a list of XY co-ordinates (where the Y values are always positive) and Data Set 2 which has the same X values but different Y values and these Y values are all negative.

I want to plot both data sets on the same plot but share the X axis.

I was hoping to create a plot similar to the one attached.

Does anyone have any ideas?

Thank you.

Attached Files

Thumbnail(s)
   
Reply
#2
Did you try .twinx axes method?
ax1 = ax0.twinx()
ax1.plot(...) # ax0 and ax1 share x-axis.
Reply
#3
scidam

Thanks.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Best way to secure API key when sharing quarinteen 2 290 Jan-19-2024, 04:46 PM
Last Post: deanhystad
  Multiple Plots in Spyder PythonAndMe2023 0 816 Feb-03-2023, 07:00 PM
Last Post: PythonAndMe2023
  How to install modules for 2.7 (or sharing from 3.8)) Persisto 2 2,373 Dec-31-2021, 02:33 PM
Last Post: Persisto
  Subplot - Plotting 4 plots on the same row Menthix 1 1,391 Nov-07-2021, 09:03 PM
Last Post: deanhystad
  Sample labels from excel file in order to put them on x-axis and y-axis of a plot hobbyist 11 4,232 Sep-14-2021, 08:29 AM
Last Post: hobbyist
  multiprocessing and sharing object cyrduf 0 2,010 Feb-02-2021, 08:16 PM
Last Post: cyrduf
  sharing variables between two processes Kiyoshi767 1 1,848 Nov-07-2020, 04:00 AM
Last Post: ndc85430
  How can I scroll over my data points when creating plots in Python? (I'm using Spyder moose 0 1,582 Nov-02-2020, 07:18 AM
Last Post: moose
  Sharing my code emirasal 2 1,997 Oct-04-2020, 02:21 PM
Last Post: emirasal
  Sharing X Axis in Sub plots JoeDainton123 1 2,140 Aug-22-2020, 04:11 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020