Matplotlib axes类

简介: Matplotlib axes类
import matplotlib.pyplot as plt
y = [1, 4, 9, 16, 25,36,49, 64]
x1 = [1, 16, 30, 42,55, 68, 77,88]
x2 = [1,6,12,18,28, 40, 52, 65]
fig = plt.figure()
ax = fig.add_axes([0,0,1,1])
#使用简写的形式color/标记符/线型
l1 = ax.plot(x1,y,'ys-') 
l2 = ax.plot(x2,y,'go--') 
ax.legend(labels = ('tv', 'Smartphone'), loc = 'lower right') # legend placed at lower right
ax.set_title("Advertisement effect on sales")
ax.set_xlabel('medium')
ax.set_ylabel('sales')
plt.show()
AI 代码解读
目录
打赏
0
相关文章
【matplotlib】fig,axes=plt.subplots(nrows=2,ncols=2,figsize=(10,10))
【matplotlib】fig,axes=plt.subplots(nrows=2,ncols=2,figsize=(10,10))
187 0
【matplotlib】fig,axes=plt.subplots(nrows=2,ncols=2,figsize=(10,10))
Python--Matplotlib库与数据可视化③--Figures、Axes对象与多图绘制
Python--Matplotlib库与数据可视化③--Figures、Axes对象与多图绘制
235 0
Python--Matplotlib库与数据可视化③--Figures、Axes对象与多图绘制
成功解决matplotlib\axes\_axes.py:6462: UserWarning: The 'normed' kwarg is deprecated, and has been repla
成功解决matplotlib\axes\_axes.py:6462: UserWarning: The 'normed' kwarg is deprecated, and has been repla
以下是一些常用的图表类型及其Python代码示例,使用Matplotlib和Seaborn库。
通过这些思维导图和分析说明表,您可以更直观地理解和选择适合的数据可视化图表类型,帮助更有效地展示和分析数据。
127 8
以下是一些常用的图表类型及其Python代码示例,使用Matplotlib和Seaborn库。
以下是一些常用的图表类型及其Python代码示例,使用Matplotlib和Seaborn库。
matplotlib各种案例总结(python经典编程案例)
该文章汇总了使用matplotlib绘制不同类型图表的方法和案例,包括条形图、折线图等,并展示了如何调整颜色和线条样式等属性。
118 0