python 添加图例_Python | 在图例标签中添加Sigma
生活随笔
收集整理的這篇文章主要介紹了
python 添加图例_Python | 在图例标签中添加Sigma
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
python 添加圖例
Sigma (𝜎) is very often used greek mathematical letters and has a higher repetition in probability. In this article, we are going to add 𝜎 using a command in matplotlib.
Sigma(𝜎)是希臘數學字母中經常使用的字母,其重復率更高。 在這篇文章中,我們將添加σ在matplotlib使用命令。
plt.text(3, 0.4, r'$\sigma=100$') #Adding 𝜎 as text plt.title('Errorbar with 'r'$\sigma=100$') #Adding 𝜎 in title of the figure plt.xlabel('Time ('r'$\sigma=100)$') #Adding 𝜎 in title of the figure plt.ylabel('Variation ('r'$\sigma=100)$') #Adding 𝜎 in title of the figure在情節標簽中添加omega的Python代碼 (Python code for adding omega in plot label)
import numpy as np import matplotlib.pyplot as pltx = np.arange(0.1, 5, 0.1) y = np.sin(x)*np.exp(-x)# In text plt.figure() plt.plot(x,y, 'o', color='purple') plt.title('Errorbar') plt.text(4, 0.0, r'$\sigma=100$') plt.grid() plt.show()# In title plt.figure() plt.plot(x,y, 'o', color='purple') plt.title('Plotting with 'r'$\sigma=100$') plt.grid() plt.show()# In x-axis label plt.figure() plt.plot(x,y, 'o', color='purple') plt.xlabel('Time ('r'$\sigma=100)$') plt.grid() plt.show()# In y-axis label plt.figure() plt.plot(x,y, 'o', color='purple') plt.ylabel('Function ('r'$\sigma=100)$') plt.grid() plt.show()Output:
輸出:
Output is as figure翻譯自: https://www.includehelp.com/python/adding-sigma-in-plot-label.aspx
python 添加圖例
總結
以上是生活随笔為你收集整理的python 添加图例_Python | 在图例标签中添加Sigma的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: scanf 输入十六进制_使用C语言中的
- 下一篇: JavaScript | 如何为变量分配