代码之家  ›  专栏  ›  技术社区  ›  Herpes Free Engineer

在matplotlib中,如何放大/缩小在xlabel/ylabel中绘制的箭头?

  •  2
  • Herpes Free Engineer  · 技术社区  · 8 年前

    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()
    

    结果如下:

    .

    一个人怎么能扩展 只有 箭头而不缩放其中的文本?

    1 回复  |  直到 8 年前
        1
  •  1
  •   tmdavison    8 年前

    如果您使用 LaTeX rcParams ),然后您可以使用 用于更改文本部分的大小命令。例如。:

    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()
    

    enter image description here