29

I have a figure I added subfigure to (inset). I have used:

fig = plt.figure()
ax = fig.add_subplot(111)
subA = fig.add_axes([0.4,0.14,0.2,0.2])

I now want to change the xtick font size of the subfigure. I tried some naive approach such as

subA.get_xaxis().get_xticks().set_fontsize(10)

without any luck.

How can I do this then?

lucasg
  • 10,734
  • 4
  • 35
  • 57
Yotam
  • 10,295
  • 30
  • 88
  • 128

2 Answers2

49

Use:

subA.tick_params(labelsize=6)
gpano
  • 599
  • 5
  • 5
24
fig = plt.figure()
ax = fig.add_subplot(111)
plt.xticks([0.4,0.14,0.2,0.2], fontsize = 50) # work on current fig
plt.show()

the x/yticks has the same properties as matplotlib.text

lucasg
  • 10,734
  • 4
  • 35
  • 57