How to draw a 2-axis graph with pyplot

script

--I want to compare two plots --Since the y-axis scale is different, one is crushed and cannot be seen. ――The magic at that time

dual_plot.py


import matplotlib.pyplot as plt

fig, ax1 = plt.subplots()
ax1.plot(data1)
ax2 = ax1.twinx()  #Associate two plots
ax2.plot(data2)
plt.show()

Example of calculation result

――It feels good because the peak position and the step position overlap.

figure_1.png

Recommended Posts

How to draw a 2-axis graph with pyplot
[Python] How to draw a line graph with Matplotlib
How to draw a graph using Matplotlib
How to draw a 3D graph before optimization
Draw a graph with networkx
How to draw a bar graph that summarizes multiple series with matplotlib
[Python] How to draw a scatter plot with Matplotlib
Draw a graph with Julia + PyQtGraph (2)
Draw a loose graph with matplotlib
Draw a graph with Julia + PyQtGraph (1)
Draw a graph with Julia + PyQtGraph (3)
Draw a graph with pandas + XlsxWriter
Draw a graph with PySimple GUI
[Visualization] I want to draw a beautiful graph with Plotly
How to add a package with PyCharm
Draw a graph with PyQtGraph Part 1-Drawing
Draw a flat surface with a matplotlib 3d graph
How to read a CSV file with Python 2/3
Draw a graph with Japanese labels in Jupyter
How to Skip Correlation Graph Depiction with pandas-profiling
(Matplotlib) I want to draw a graph with a size specified in pixels
How to develop a cart app with Django
Draw a graph with PyQtGraph Part 3-PlotWidget settings
Draw a graph by processing with Pandas groupby
[Python] Draw a directed graph with Dash Cytoscape
Try to draw a life curve with python
How to make a dictionary with a hierarchical structure.
[Python] How to draw multiple graphs with Matplotlib
How to draw a vertical line on a heatmap drawn with Python seaborn
Draw a graph with PyQtGraph Part 4-PlotItem settings
Draw a graph with matplotlib from a csv file
How to create a multi-platform app with kivy
Draw a graph with PyQtGraph Part 6-Displaying a legend
[Python] How to draw a histogram in Matplotlib
Draw a graph with PyQtGraph Part 5-Increase the Y-axis
How to convert / restore a string with [] in python
How to create a submenu with the [Blender] plugin
I tried to draw a route map with Python
How to get a logged-in user with Django's forms.py
How to convert a class object to a dictionary with SQLAlchemy
How to make a shooting game with toio (Part 1)
[Python] How to create a 2D histogram with Matplotlib
Draw a graph with PyQtGraph Part 2--Detailed plot settings
How to call a function
How to update with SQLAlchemy?
How to cast with Theano
How to hack a terminal
How to Alter with SQLAlchemy?
How to separate strings with','
How to RDP with Fedora31
How to Delete with SQLAlchemy?
How to increase the axis
How to deploy a web app made with Flask to Heroku
How to make a Cisco Webex Teams BOT with Flask
Study math with Python: Draw a sympy (scipy) graph with matplotlib
How to put a hyperlink to "file: // hogehoge" with sphinx-> pdf
How to install NPI + send a message to line with python
How to kill a process instantly with Python's Process Pool Executor
How to convert an array to a dictionary with Python [Application]
How to output a document in pdf format with Sphinx
How to create a flow mesh around a cylinder with snappyHexMesh