打卡交作业啦#2022年01月11日

这次主要学习的是matplotlib的框架,原来一张图表有这么多讲究,真是学习了。


### 第一回

# fig,ax= plt.subplots()

# ax.plot([1,2,3,4],[1,4,2,3])

# plt.show()

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

# x = np.linspace(0,2,100)

# fig,ax = plt.subplots()

# ax.plot(x,x,label = 'linear')

# ax.plot(x,x**2,label='quadratic')

# ax.plot(x,x**3,label='cubic')

# ax.set_xlabel('x label')

# ax.set_ylabel('y label')

# ax.set_title('Simple Plot')

# ax.legend()

# plt.show()

# x = np.linspace(0,2,100)

# plt.plot(x,x,label = 'linear')

# plt.plot(x,x**2,label = 'quadratic')

# plt.plot(x,x**3,label = 'cubic')

# plt.xlabel('x label')

# plt.ylabel('y label')

# plt.title('Simple Plot')

# plt.legend()

# plt.show()


# ## 通用模板

# # step1 准备数据

# x = np.linspace(0,2,100)

# y = x**2

# # step2 设置绘图样式

# mpl.rc('lines',linewidth = 4,linestyle = '-.')

# # step3 定义布局

# fig,ax = plt.subplots()

# # step4 绘制图像

# ax.plot(x,y,label = 'linear')

# # step5 添加标签、文字和图例

# ax.set_xlabel('x label')

# ax.set_ylabel('y label')

# ax.set_title('Simple Plot')

# ax.legend();

## 思考题

# 1、请思考两种绘图模式的优缺点和各自适合的使用场景

# 2、在第五节绘图模板中我们是以OO模型作为例子展示的,请思考并写一个pyplot绘图模式的简单模板

# 1

# (1)显式创建适合需要创建多个图时,自动创建适合只有一张图时

# 2

# x = np.linspace(0,2,100)

# y = x**2

# plt.plot(x,y,label = 'linear')

# plt.xlabel('x label')

# plt.ylabel('y label')

# plt.title('自动创建')

# plt.legend()

# plt.show();

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 首先导入模块 import numpy as npimport matplotlibimport matplotl...
    休提前事阅读 1,054评论 0 0
  • 1、Matplotlib简介 matplotlib是基于python语言的开源项目,旨在为python提供一个数据...
    国宝级初学者阅读 2,879评论 0 0
  • 很多机器学习的问题都会涉及到有着几千甚至数百万维的特征的训练实例。这不仅让训练过程变得非常缓慢,同时还很难找到一个...
    城市中迷途小书童阅读 3,840评论 0 2
  • 1.使用matplotlib的pyplot模块绘图 pyplot 主要用于交互式绘图和编程绘图生成简单图例。 2....
    蓝天下悠闲的云朵阅读 525评论 0 0
  • 一、概述 深度学习的一个重要手段是训练数据和训练过程的可视化,因此,我们关于深度学习的系列介绍文章就从Matplo...
    aoqingy阅读 6,338评论 0 24