python3 绘图库_Python3绘图库Matplotlib(01)

importmatplotlib.pyplot as plt

plt.plot([1, 2, 3])

plt.savefig("plot123.png")

plt.savefig('plot123_2.png', dpi=200)#importmatplotlib as mpl

mpl.rcParams['figure.figsize']

mpl.rcParams['savefig.dpi']

mpl.reParams['Agg']

9 本小结所有代码示例

import matplotlib.pyplot as plt

plt.plot([1, 3, 2, 4])

plt.show()

import matplotlib.pyplot as plt

x = range(6)

plt.plot(x, [xi**2 for xi in x])

plt.show()

import matplotlib.pyplot as plt

import numpy as np

x = np.arange(0.0, 6.0, 0.01)

plt.plot(x, [x**2 for x in x])

plt.show()

import matplotlib.pyplot as plt

import numpy as np

x = np.arange(1, 5)

plt.plot(x, x*1.5, x, x*3.0, x, x/3.0)

plt.grid(True)

plt.show()

import matplotlib.pyplot as plt

import numpy as np

x = np.arange(1, 5)

plt.plot(x, x*1.5, x, x*3.0, x, x/3.0)

plt.axis() # 显示当前坐标轴的极限取值范围 x->(0.85, 4.15), y->(-0.25, 12.58)

plt.axis([0, 5, -1, 13]) # 从新设置当前坐标轴的范围

plt.show()

import matplotlib.pyplot as plt

plt.plot([1, 3, 2, 4])

plt.xlabel('This is the X axis') #这个是x轴的标签

plt.ylabel('This is the Y axis') #这个是y轴的标签

plt.show()

import matplotlib.pyplot as plt

plt.plot([1, 3, 2, 4])

plt.title('Simple plot') # 图像的标题

plt.show()

import matplotlib.pyplot as plt

import numpy as np

x = np.arange(1, 5)

plt.plot(x, x*1.5, label="Normal")

plt.plot(x, x*3.0, label="Fast")

plt.plot(x, x/3.0, label="Slow")

plt.legend() # 设置图例

plt.show()

import matplotlib.pyplot as plt

import numpy as np

x = np.arange(1, 5)

plt.plot(x, x*1.5, x, x*3.0, x, x/3.0)

plt.grid(True)

plt.title('Sample Growth of a Measure')

plt.xlabel('Samples')

plt.ylabel('Values Measured')

plt.legend(['Normal', 'Fast', 'Slow'], loc = 'upper left')

plt.show()

import matplotlib.pyplot as plt

plt.plot([1, 2, 3])

plt.savefig("plot123.png")

import matplotlib as mpl

mpl.rcParams['figure.figsize']

mpl.rcParams['savefig.dpi']

plt.savefig('plot123_2.png', dpi=200)

知识在于点点滴滴的积累,我会在这个路上Go ahead,

有幸看到我博客的朋友们,若能学到知识,请多多关注以及讨论,让我们共同进步,扬帆起航。

后记:打油诗一首

适度锻炼,量化指标

考量天气,设定目标

科学锻炼,成就体标

高效科研,实现学标

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值