menu_book Course Curriculum (Matplotlib) expand_more
Figure Basics
Axes & Labels
Styling
Layouts
Statistical Plots
Images & Geometry
Scales & Dates
Output & Interaction
Secondary axis
Learn Secondary axis in Matplotlib with a dedicated explanation, a topic-specific example, edge guidance, and a mastery check.
12 min read
•
Advanced
Advertisement
matplotlib-053.py
python
import matplotlib.pyplot as plt
import numpy as np
fig,ax=plt.subplots(); ax.plot([0,10,20],[32,50,68]); sec=ax.secondary_yaxis("right",functions=(lambda f:(f-32)*5/9,lambda c:c*9/5+32)); sec.set_ylabel("°C"); plt.show()
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content