首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

第五章Matplotlib Charts学习笔记

第五章Matplotlib Charts

Creating beautiful charts using Matplotlib

Matplotlib – downloading modules using pip

Matplotlib – downloading modules with whl extensions

Creating our first chart

Placing labels on charts

How to give the chart a legend

Scaling charts

Adjusting the scale of charts dynamically

第一节:Creating beautiful charts using Matplotlib

绘制了一个3D图形

Matplotlib网站:

https://matplotlib.org/users/screenshots.html

第二节:Matplotlib – downloading modules using pip

第三节:Matplotlib – downloading modules with whl extensions

这两节主要讲怎么安装matplotlib

第四节:Creating our first chart

python中numpy的arange不是安排什么,而是创建了一个序列

第五节:Placing labels on charts

我们import了matplotlib模块创建了一个canvas和一个figure来画图

设置x和y的坐标值和一些关于图表的参数

第六节:How to give the chart a legend

添加图例

fig.legend((t0,t1,t2),('pie','cherry pie','RR'),'upper right')

添加图例,传入的是元组

第一个参数是变量的元组,第二个参数是每条线的命名的元组,第三个参数是图例的位置在右上方

第七节:Scaling charts

axis.set_ylim(5,8)

设置了y轴的取值范围

第八节:Adjusting the scale of charts dynamically

把x轴的取值也设置在(0,8)之间

但这个图看起来还是非常怪异

我们将y轴的取值范围设置在y0,y1和y2中的最小值和最大值之间

x轴的取值范围设置在x的最小值和最大值之间

  • 发表于:
  • 原文链接https://kuaibao.qq.com/s/20181103G1NW3V00?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券