python添加标签_Python | 在地块标签中添加欧米茄

python添加标签

𝜔 is very oftenly used greek mathematical letters and has a higher repetition in probability. In this article, we are going to add 𝜔 using a command in matplotlib.

𝜔非常经常使用希腊数学字母,并且重复的概率更高。 在这篇文章中,我们将添加ω在matplotlib使用命令。

plt.text(3, 0.4, r'$\omega=100$')
#Adding 𝜔 as text

Python | Adding Omega in Plot Label (1)
plt.title('Errorbar with 'r'$\omega=100$')
#Adding 𝜔 in title of the figure

Python | Adding Omega in Plot Label (2)
plt.xlabel('Time ('r'$\omega=100)$')
#Adding 𝜔 in title of the figure

Python | Adding Omega in Plot Label (3)
plt.ylabel('Variation ('r'$\omega=100)$')
#Adding 𝜔 in title of the figure

Python | Adding Omega in Plot Label (4)

在情节标签中添加omega的Python代码 (Python code for adding omega in plot label)

import numpy as np
import matplotlib.pyplot as plt

x = np.arange(0.1, 50, 0.2)
y = np.sin(x)*np.exp(-0.09*x)

# In text
plt.figure()
plt.plot(x,y, 'o', color='purple')
plt.title('Errorbar')
plt.text(40, 0.2, r'$\omega=100$', fontsize=15)
plt.grid()
plt.show()

# In title
plt.figure()
plt.plot(x,y, 'o', color='purple')
plt.title('Plotting with 'r'$\omega=100$')
plt.grid()
plt.show()

# In x-axis label
plt.figure()
plt.plot(x,y, 'o', color='purple')
plt.xlabel('Time ('r'$\omega=100)$')
plt.grid()
plt.show()

# In y-axis label
plt.figure()
plt.plot(x,y, 'o', color='purple')
plt.ylabel('Function ('r'$\omega=100)$')
plt.grid()
plt.show()

Output:

输出:

Output is as figure


翻译自: https://www.includehelp.com/python/adding-omega-in-plot-label.aspx

python添加标签

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值