标签:style color os io for cti ar line
state-machine environment
object-oriente interface
figure and axes
backend and frontend
user interface bankends
hardcopy backends or non-interactive backends
confugure your backends
renderer : AGG
import matplotlib.pyplot as plt
plt.plot() 可一次画好几个, return al list of lines.
b-, ro, bo, k, r--, bs, g^, g-, go-, o, -, r, r+, rs
- solid line
-- dashed line
-. dash-dot line
: dotted line
. point marker
, pixel marker
o cercle marker
v triangle_down marker
^ triangle_up marker
< triangle_left marker
> triangle_right marker
1 2 3 4 试试什么形状
s square marker
p pentagon marker
* star marker
h H
+ plus marker
D diamond marker
d thin_diamond marker
| vline marker
- hline marker
b blue
g green
r red
c cyan
m magenta
y yellow
k black
w white
linewidth = 2.0,
label = ‘line 1‘
legend() 会根据你的线的label 生成,如果你设置每个line的label的话
line, = plt.plot(x, y, ‘-‘)
line就是这个线对象, 方法有:set_antialiased(False),
plt.setp(lines, color=‘r‘, linewidth=2.0) 这是keyword args.
或
plt.setp(lines, ‘color‘, ‘r‘, ‘linewidth‘, 2.0) 这是MATLAB style, string value pairs
关于lines properties, 还有很多。可以用plt.setp(lines) 来看, 看看lw=2 什么意思
plt.axis([x-st, x-end, y-st, y-end])
plt.ylabel()
plt.show()
gca()返回current axes
gcf() 返回current figure
plt.figure(1) #可以不用写,因为如果你不指定的话,figure(1) 和subplot(1,1,1) 都是默认创建的
plt.subplot(211) # 当前是figure1的subplot 211
plt.plot(x1, f(x1), x2, ‘bo‘, f(x2), ‘k‘ )
plt.subplot(212) #当前是figure1 的subplot 212
plt.plot(x, f(x), ‘r--‘)
subplot(rows, cols, fignum), 所以一共有rows*cols个图, fignum 指定是第几个
如果想更个性的话,用axes(left, bottom, width, height) 每个值都介于0和1之间。
clf() clear current figure
cla() clear current axes
the mamory required for a figure is not completely realeased until the figure is closed with close()
plt.text() 可以让你在图的任意位置加上文字信息。 plt.xlabel(), plt.ylabel(), plt.title() 在指定位置加文字信息。
just as with lines above, you can customize the propertied by passing keyword arguments into the text functions or using setp()
eg: plt.xlebel(‘hehe‘, fontsize=14, color=‘red‘)
plt.grid(True) 默认是False
plt.annotate(‘luanqibazaodezhushi‘, xy=(2,1), xytext=(3, 1.5), arrowprops=dict(facecolor=‘black‘, shrink=0.05),) 加上注释文本
pltylim(-2, -2)
用python matplotlib 画图,布布扣,bubuko.com
标签:style color os io for cti ar line
原文地址:http://www.cnblogs.com/freemao/p/3871926.html