Subplot axis properties

 

ax.spines[‘bottom’].set_color(‘#dddddd’)
ax.spines[‘top’].set_color(‘#dddddd’)
ax.spines[‘right’].set_color(‘red’)
ax.spines[‘left’].set_color(‘red’)
Use the following to change only the ticks:

ax.tick_params(axis=’x’, colors=’red’)
ax.tick_params(axis=’y’, colors=’red’)
And the following to change only the label:

ax.yaxis.label.set_color(‘red’)
ax.xaxis.label.set_color(‘red’)
And finally the title:

ax.title.set_color(‘red’)

https://stackoverflow.com/questions/4761623/changing-the-color-of-the-axis-ticks-and-labels-for-a-plot-in-matplotlib

x.set_xticklabels([str(x)+”foo” for x in range(6)], rotation=45)

 

ax.set_title("Function performance",fontsize=14)
ax.set_xlabel("code executions",fontsize=12)
ax.set_ylabel("time(s)",fontsize=12)
ax.grid(True,linestyle='-',color='0.75')
ax1.set_xlim([0, 5])
ax1.set_ylim([0, 5])
https://matplotlib.org/devdocs/api/_as_gen/matplotlib.axes.Axes.set_xlim.html

from matplotlib import pyplot as plt
plt.plot(range(10))
plt.tick_params(
axis=’x’, # changes apply to the x-axis
which=’both’, # both major and minor ticks are affected
bottom=’off’, # ticks along the bottom edge are off
top=’off’, # ticks along the top edge are off
labelbottom=’off’) # labels along the bottom edge are off
plt.show()
plt.savefig(‘plot’)
plt.clf()

Leave a comment