How to set a secondary y-axis in Python
Question: I'm currently trying to change the secondary y-axis values in a matplot graph
to `ymin = -1` and `ymax = 2`. I can't find anything on how to change the
values though. I am using the `secondary_y = True` argument in `.plot()`, so I
am not sure if changing the secondary y-axis values is possible for this. I've
included my current code for creating the plot.

    
    
    df.plot()
    df.plot(secondary_y = "Market") 
    


Answer: From your example code, it seems you're using Pandas built in ploting
capabilities. One option to add a second layer is by using matplotlib directly
like in the [example
"two_scales.py"](http://matplotlib.org/examples/api/two_scales.html).

It uses

    
    
    import matplotlib.pyplot as plt
    fig, ax1 = plt.subplots()
    ax1.plot(df["..."])
    # ...
    ax2 = ax1.twinx()
    ax2.plot(df["Market"])
    ax2.set_ylim([0, 5])
    

where you can change the y-limits.

