xlabel/ylabel 内绘制的箭头如何在 matplotlib 中缩放 up/down?
How could an arrow drawn within xlabel/ylabel be scaled up/down in matplotlib?
在this question中解释了xlabel/ylabel中箭头的生成。解释举例:
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1)
# plot your data here ...
ax.set_xlabel(r'$\rho/\rho_{ref}\;\rightarrow$', color='red')
ax.set_ylabel(r'$\Delta \Theta / \omega \longrightarrow$')
plt.show()
结果如下:
怎么可能只缩放箭头而不缩放其中的文本?
如果您使用LaTeX
渲染文本(使用rcParams
),那么您可以使用LaTeX
大小命令来改变部分文本。例如:
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
fig, ax = plt.subplots(1, 1)
ax.set_xlabel(r'$\rho/\rho_{ref} \;$ \Huge{$ \rightarrow $}', color='red')
ax.set_ylabel(r'$\Delta \Theta / \omega $ \Huge{$\longrightarrow$}')
plt.show()
在this question中解释了xlabel/ylabel中箭头的生成。解释举例:
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1)
# plot your data here ...
ax.set_xlabel(r'$\rho/\rho_{ref}\;\rightarrow$', color='red')
ax.set_ylabel(r'$\Delta \Theta / \omega \longrightarrow$')
plt.show()
结果如下:
怎么可能只缩放箭头而不缩放其中的文本?
如果您使用LaTeX
渲染文本(使用rcParams
),那么您可以使用LaTeX
大小命令来改变部分文本。例如:
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
fig, ax = plt.subplots(1, 1)
ax.set_xlabel(r'$\rho/\rho_{ref} \;$ \Huge{$ \rightarrow $}', color='red')
ax.set_ylabel(r'$\Delta \Theta / \omega $ \Huge{$\longrightarrow$}')
plt.show()