Adding a y-axis label to secondary y-axis in matplotlib

前端 未结 4 867
情深已故
情深已故 2020-11-27 10:04

I can add a y label to the left y-axis using plt.ylabel, but how can I add it to the secondary y-axis?

table = sql.read_frame(query,connection)
         


        
4条回答
  •  不知归路
    2020-11-27 11:01

    I don't have access to Python right now, but off the top of my head:

    fig = plt.figure()
    
    axes1 = fig.add_subplot(111)
    # set props for left y-axis here
    
    axes2 = axes1.twinx()   # mirror them
    axes2.set_ylabel(...)
    

提交回复
热议问题