【问题标题】:How do I get python to display xbar? A line over the letter x如何让 python 显示 xbar?字母 x 上的一条线
【发布时间】:2014-07-16 21:08:39
【问题描述】:

我一直在研究数学符号和不同的软件包,但还没有找到任何可以让我打印 xbar(平均 x)的东西。

我希望在 matplotlib 中使用 xbar 作为标签。

有什么建议吗?

谢谢。干杯

【问题讨论】:

    标签: python text matplotlib notation


    【解决方案1】:

    如果你想在 matplotlib 中使用 x bar 作为标签,你可以这样做:

    plt.ylabel(r'$\bar{x}$')
    

    【讨论】:

    • +1 打败我!还要注意\overline{xyz} 用于多个字符,\mathregular{\bar{x}} 如果您希望它使用非数学字体,则它与其他文本看起来无缝。
    【解决方案2】:

    如果您使用的是 jupyter,您只需对一个字母 (x) 执行此操作:

    $\bar x$   
    
    #or for a string   
    $\overline {xyzabc}$   
    
    #note that one $ will give you an inline output and $$...$$ would start  
    #a new line after your output
    

    【讨论】:

      猜你喜欢
      • 2018-01-22
      • 1970-01-01
      • 2020-03-31
      • 1970-01-01
      • 2018-08-03
      • 2018-08-03
      • 2012-01-01
      • 2017-06-16
      • 1970-01-01
      相关资源
      最近更新 更多