相关文章推荐
眉毛粗的毛衣  ·  AttributeError: ...·  6 天前    · 
风流的日记本  ·  javascript - 用 js ...·  1 年前    · 
面冷心慈的花卷  ·  Virtual Machine ...·  2 年前    · 
from matplotlib import pyplot as plt
x = range(1,10) #x轴的位置
y = [6,7,12,12,15,17,15,20,18] #y轴的位置
#传入x,y,通过plot画图,并设置折线颜色、透明度、折线样式和折线宽度  标记点、标记点大小、标记点边颜色、标记点边宽
plt.plot(x,y,color='red',alpha=0.3,linestyle='--',linewidth=5,marker='o'
         ,markeredgecolor='r',markersize='20',markeredgewidth=10)
plt.show()

效果截图:

标记类型:

marker symbol description
"." m00 point
"," m01 pixel
"o" m02 circle
"v" m03 triangle_down
"^" m04 triangle_up
"<" m05 triangle_left
">" m06 triangle_right
"1" m07 tri_down
"2" m08 tri_up
"3" m09 tri_left
"4" m10 tri_right
"8" m11 octagon
"s" m12 square
"p" m13 pentagon
"P" m23 plus (filled)
"*" m14 star
"h" m15 hexagon1
"H" m16 hexagon2
"+" m17 plus
"x" m18 x
"X" m24 x (filled)
"D" m19 diamond
"d" m20 thin_diamond
"|" m21 vline
"_" m22 hline
0 ( TICKLEFT ) m25 tickleft
1 ( TICKRIGHT ) m26 tickright
2 ( TICKUP ) m27 tickup
3 ( TICKDOWN ) m28 tickdown
4 ( CARETLEFT ) m29 caretleft
5 ( CARETRIGHT ) m30 caretright
6 ( CARETUP ) m31 caretup
7 ( CARETDOWN ) m32 caretdown
8 ( CARETLEFTBASE ) m33 caretleft (centered at base)
9 ( CARETRIGHTBASE ) m34 caretright (centered at base)
10 ( CARETUPBASE ) m35 caretup (centered at base)
11 ( CARETDOWNBASE ) m36 caretdown (centered at base)
"None" , " " or "" nothing
'$...$' m37 Render the string using mathtext. E.g "$f$" for marker showing the letter f .
verts A list of (x, y) pairs used for Path vertices. The center of the marker is located at (0, 0) and the size is normalized, such that the created path is encapsulated inside the unit cell.
path A Path instance.
(numsides, 0, angle) A regular polygon with numsides sides, rotated by angle .
(numsides, 1, angle) A star-like symbol with numsides sides, rotated by angle .
(numsides, 2, angle) An asterisk with numsides sides, rotated by angle .
代码示例:from matplotlib import pyplot as pltx = range(1,10) #x轴的位置y = [6,7,12,12,15,17,15,20,18] #y轴的位置#传入x,y,通过plot画图,并设置折线颜色、透明度、折线样式和折线宽度 标记点、标记点大小、标记点边颜色、标记点边宽plt.plot(x,y,color='red',alpha=0.3,linestyle='--',linewidth=5,marker='o' ,marke
Matplotlib 是 Python 的绘图库。 它可与 NumPy 一起使用,提供了一种有效的 MatLab 开源替代方案。 它也可以和图形工具包一起使用,如 PyQt 和 wxPython。 今天是数据处理专题的第11篇文章,我们继续来介绍 matplotlib 这个包的使用方法。 在上一篇文章当中我们介绍了 matplotlib 当中subplot的概念以及用法,今天我们将会来介绍 matplotlib 绘图中的一些具体的设置,可以让我们画出来的图像更加丰富,表现力也更强。 我们之前绘制的图像都是蓝色的,这也是 matplotlib 的默认 颜色 。我们可以使用color这个参数来设置图像的 颜色 ,比
在用python画散 图的时候想 标记 特定 ,比如在某些 的外围加个空心圆,一样可以通过plt.scatter实现 import matplotlib .pyplot as plt x = [[1, 3], [2, 5]] y = [[4, 7], [6, 3]] for i in range(len(x)): plt.plot(x[i], y[i], color='r') plt.scatter(x[i], y[i], color='b') plt.scatter(x[i], y[i], color='', marker='o', edgecolors='g', s=200)
def demo_test(): a=np.array([0.15,0.16,0.14,0.17,0.12,0.16,0.1,0.08,0.05,0.07,0.06]); max_indx=np.argmax(a)#max value index min_... import numpy as np plt.style.use(‘classic’) plt.rcParams[‘font.sans-serif’] = [‘SimHei’] #解决中文显示 plt.rcParams[‘axes.unicod...
Matplotlib 折线图 (绘图实例+代码详解) 折线图 (line chart)是我们日常工作、学习中经常使用的一种图表,它可以直观的反映数据的变化趋势。与绘制柱状图、饼状图等图形不同, Matplotlib 并没有直接提供绘制 折线图 的函数,因此本节着重讲解如何绘制一幅 折线图 。 绘制单条折线 下面示例是关于用户活跃度的 折线图 : import matplotlib .pyplot as plt #准备绘制数据 x = ["Mon", "Tues", "Wed", "Thur", "Fri","Sat","Sun"
plot([x], y, [fmt], data=None, **kwargs) plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs) 和线的坐标由参数x,y提供。可选参数fmt是一个快捷字符串,用于定义 颜色 标记 符合和线条形状,例如: &gt;&gt;&gt... 折线图 折线图 (line chart)是我们在数据分析、数据展示中经常使用的一种图表,它可以直观的反映数据的变化趋势。与绘制柱状图、饼状图等图形不同, Matplotlib 并没有直接提供绘制 折线图 的函数。线图适用于分析数据随时间变化的趋势。例如,分析商品销量随时间的变化,预测未来的销售情况。 通过 matplotlib .pyplot.plot函数来绘制 折线图 ,plot函数已经.