Python Forum

Full Version: Setting Tick Intervals In Sub Plots
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello all

I was hoping someone could point me in the right direction regarding setting the intervals for the Y axis ticks.

I have the following code:-
axes[0].plot((df_raw_data.iloc[start_counter:end_counter,5]),(df_raw_data.iloc[start_counter:end_counter,6])) # 1
axes[0].set_ylabel("Y Label", fontsize=5, weight="bold") # 2
axes[0].set_ylim(25,-25) # 3
axes[0].yaxis.set_tick_params(labelsize = 6)# 4
Line 1 plots the data
Line 2 creates a Y axis label
Line 3 sets the limits of my y axis in this case between 25 & -25
Line 4 sets the font size of my y axis values.

I want to set the increments to 5 (or any value for that matter but also but i want the the value 25 & -25 shown on the Y axis these last values always seem to be omitted.

Can anyone help?

Thank you.
You need to define yticks explicitly, e.g. ax.set_yticks(range(-25, 26, 5)).