Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

matplotlib plot two y axes

# create figure and axis objects with subplots()
fig,ax = plt.subplots()
# make a plot
ax.plot(gapminder_us.year,
        gapminder_us.lifeExp,
        color="red", 
        marker="o")
# set x-axis label
ax.set_xlabel("year", fontsize = 14)
# set y-axis label
ax.set_ylabel("lifeExp",
              color="red",
              fontsize=14)
Source by cmdlinetips.com #
 
PREVIOUS NEXT
Tagged: #matplotlib #plot #axes
ADD COMMENT
Topic
Name
4+9 =