Creating Plots & Sharing X Axis - 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: Creating Plots & Sharing X Axis (/thread-30065.html) |
Creating Plots & Sharing X Axis - JoeDainton123 - Oct-02-2020 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. RE: Creating Plots & Sharing X Axis - scidam - Oct-05-2020 Did you try .twinx axes method? ax1 = ax0.twinx() ax1.plot(...) # ax0 and ax1 share x-axis. RE: Creating Plots & Sharing X Axis - JoeDainton123 - Oct-05-2020 scidam Thanks. |