2021年3月13日

scatter()绘制一些列点

摘要: import matplotlib.pyplot as pltx_values = [1,2,3,4,5]y_values = [1,4,9,16,25] # y_values = [x ** 1 for x in x_values]fig,ax = plt.subplots() ax.scatte 阅读全文

posted @ 2021-03-13 23:54 winecork 阅读(64) 评论(0) 推荐(0) 编辑

用scatter()绘制散点图

摘要: import matplotlib.pyplot as plt fig,ax = plt.subplots() ax.scatter(2,4) plt.show() 阅读全文

posted @ 2021-03-13 23:51 winecork 阅读(83) 评论(0) 推荐(0) 编辑

使用内置款式

摘要: import matplotlib.pyplot as plt input_values = [1,2,3,4,5] squares = [1,4,9,16,25] plt.style.use('ggplot') # 绘制图表时使用款式ggplot fig,ax = plt.subplots() a 阅读全文

posted @ 2021-03-13 23:34 winecork 阅读(45) 评论(0) 推荐(0) 编辑

校正图形

摘要: 由于之前绘制squares列表图表时,图上点位与坐标轴刻度对应不上,特此修复 import matplotlib.pyplot as plt input_values = [1,2,3,4,5] # 新加变量input_values,为将与squares组成横纵坐标点 squares = [1,4, 阅读全文

posted @ 2021-03-13 23:28 winecork 阅读(52) 评论(0) 推荐(0) 编辑

修改标签文字和线条粗细

摘要: import matplotlib.pyplot as plt squares = [1,4,9,16,25] fig,ax = plt.subplots() ax.plot(squares,linewidth=15) # 设置折线宽度15 ax.set_title("Title",fontsize 阅读全文

posted @ 2021-03-13 23:12 winecork 阅读(225) 评论(0) 推荐(0) 编辑

matplotmib绘制简单折线图

摘要: 安装matplotlib模块 $ python -m pip install matplotlib 绘制简单折线图 import matplotlib.pyplot as plt # 导入模块matplotlib并起别名plt,方便调用 squares = [1,4,9,16,25] # 创建列表, 阅读全文

posted @ 2021-03-13 22:56 winecork 阅读(160) 评论(0) 推荐(0) 编辑

导航