#1 windows安装html
Python安装文件集成了matplotlib,只是注意安装的时候,选项中要把tcl/tck勾上,否则运行的时候会报错。windows
#2 导入 import matplotlib.pyplot as pltapi
教程标题 | 主要内容 |
---|---|
关于Markdown | 简介Markdown,Markdown的优缺点 |
Markdown基础 | Markdown的基本语法,格式化文本、代码、列表、连接和图片、分割线、转义符等 |
Markdown表格和公式 | Markdown的扩展语法,表格、公式 |
#3 画点(plot)code
plot方法通常是画线,可是若是只给一个点的坐标,也能够画点。(pyplot彷佛把点称为marker) 好比:plt.plot(20, 30, "+")
plot api文档 除了坐标以外还必须指定点的形状不然看不到画的点。
plot方法的调用有两种形式:
1 plt.plot(x, y, "内置形状|颜色") 2 plt.plot(x, y, color='red', marker='o', markerfacecolor='blue', markersize=12) color和makerfacecolor指定一个就好了,若是二者同时出现,已后者为准。htm
内置形状以下表:教程
marker | description |
---|---|
”.” | point |
”,” | pixel |
“o” | circle |
“v” | triangle_down |
“^” | triangle_up |
“<” | triangle_left |
“>” | triangle_right |
“1” | tri_down |
“2” | tri_up |
“3” | tri_left |
“4” | tri_right |
“8” | octagon |
“s” | square |
“p” | pentagon |
“*” | star |
“h” | hexagon1 |
“H” | hexagon2 |
“+” | plus |
“x” | x |
“D” | diamond |
“d” | thin_diamond |
“ | ” |
“_” | hline |
完整的内容能够参考官方文档
内置颜色:
character | color ---- | ---- ‘b’| blue ‘g’| green ‘r’| red ‘c’| cyan ‘m’| magenta ‘y’| yellow ‘k’| black ‘w’| white图片
除了内置颜色,根据plot文档,还能够有其余方式:
including full names ('green'), hex strings ('#008000'), RGB or RGBA tuples ((0,1,0,1)) or grayscale intensities as a string ('0.8')ip