添加坐标轴标签和标题
在图表中添加标签非常重要,这样其他人才能清楚它想表达的信息。 在本练习中,您将为上一题中创建的图表添加标签。
本练习是课程的一部分
Python 金融入门
练习说明
- 添加以下标签:
- x 轴:
'Days' - y 轴:
'Prices, $' - 标题:
'Company Stock Prices Over Time'
- x 轴:
交互式实操练习
通过完成这段示例代码来试试这个练习。
import matplotlib.pyplot as plt
# Plot price as a function of time
plt.plot(days, prices, color="red", linestyle="--")
# Add x and y labels
____('Days')
____('Prices, $')
# Add plot title
____('Company Stock Prices Over Time')
# Show plot
plt.show()