[ Web Proxy ]
URL:
Viewing: https://matplotlib.org/gallery/mplot3d/../misc/../mplot3d/../axes_grid1/parasite_simple.html [Back]  [Original]

Parasite Simple — Matplotlib 3.11.2 documentation
Back to top
Search the docs ...:

Parasite Simple#

parasite simple [parasite simple]
import matplotlib.pyplot as plt

from mpl_toolkits.axes_grid1 import host_subplot

host = host_subplot(111)
par = host.twinx()

host.set_xlabel("Distance")
host.set_ylabel("Density")
par.set_ylabel("Temperature")

p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density")
p2, = par.plot([0, 1, 2], [0, 3, 2], label="Temperature")

host.legend(labelcolor="linecolor")

host.yaxis.label.set_color(p1.get_color())
par.yaxis.label.set_color(p2.get_color())

plt.show()

Gallery generated by Sphinx-Gallery


Web Proxy Viewer  |  New URL  |  Original Page