Home > other >  Matplotlib drawing, consult the axis calibration text size can't adjust what reason be?
Matplotlib drawing, consult the axis calibration text size can't adjust what reason be?

Time:03-05

Consult the axis calibration text size can't adjust what reason be?
I use the command is:
Host. Tick_params (axis="left", labelsize=14)
Par1. Tick_params (axis="y", labelsize=14)
How should change?

 the from mpl_toolkits. Axes_grid1 import host_subplot 
The import mpl_toolkits. Axisartist as AA

The host=host_subplot (111, axes_class=AA. Axes)
Pyplot. Subplots_adjust (right=0.9)
Par1=host. Twinx ()
Par2=host. Twinx ()
Offset=60
New_fixed_axis=par2. Get_grid_helper (.) new_fixed_axis
Par2. Axis (" right ")=new_fixed_axis (loc="right",
Axes=par2,
Offset=(offset, 0))
Par1. Axis [r]. "right" toggle (all=True)
Par2. Axis [r]. "right" toggle (all=True)
Host. Set_xlim (0, 30)
Host. Set_ylim (150, 150)

Host. Set_xlabel (' Time (s) ")
Host. Set_ylabel (' Torque (N.m) ')
Par1. Set_ylabel (' Vehicle speed (km/h) ')
Par2. Set_ylabel (" Pedal degree (%) ")

P1,=host. The plot ([0, 1, 2], [0, 1, 2], '-' ko, ms=8, markevery=20, markerfacecolor='none', label="Engine torque (N.m)")
P11,=host. The plot ([0, 1, 2], [4, 5, 6], 'kx -'=8, ms markevery=20, markerfacecolor='none', label="Motor torque (N.m)")
P2,=par1. The plot ([0, 1, 2], [0, 3, 2], '^ -, ms=8, markevery=20, markerfacecolor=' none ', label="Temperature")
P3,=par2. The plot ([0, 1, 2], [50, 30, 15], 's -, ms=8, markevery=20, markerfacecolor=' none ', label="Velocity")

Par1. Set_ylim (0, 60)
Par2. Set_ylim (0, 100)

Host. Legend (fontsize=12)

The host. The axis [r]. "the left" label. Set_color (p1) get_color ())
The host. The axis [r]. "the left" label. Set_fontsize (14)
Host. Axis [r]. "bottom" label. Set_fontsize (14)
Par1. Axis [r]. "right" label. Set_color (p2) get_color ())
Par1. Axis [r]. "right" label. Set_fontsize (14)
Par2. Axis [r]. "right" label. Set_color (p3) get_color ())
Par2. Axis [r]. "right" label. Set_fontsize (14)
Host. Tick_params (axis="left", labelsize=14)
Par1. Tick_params (axis="y", labelsize=14)
# for tick in the host. The xaxis. Get_major_ticks () :
# tick. Label. Set_fontsize (30)
# host. Xaxis. Set_tick_params (size=14)
# pyplot. Xticks (range (0,30,5), fontsize=30)
# pyplot. Yticks (range (0200, 50), fontsize=30)
Pyplot. The show ()
  • Related