import matplotlib.pyplot as plt
[1] pyplot.plot
plot(y) # plot y using x as index array 0..N-1
plt.plot(x[:,0],y,'ro',x[:,1],y,'bo')
plot(x, y, color='green', linestyle='dashed', marker='o', markerfacecolor='blue', markersize=12).
(1)
character description
'-' solid line style
'--' dashed line style
'-.' dash-dot line style
':' dotted line style
'.' point marker
',' pixel marker
'o' circle marker
'v' triangle_down marker
'^' triangle_up marker
'<' triangle_left marker
'>' triangle_right marker
'1' tri_down marker
'2' tri_up marker
'3' tri_left marker
'4' tri_right marker
's' square marker
'p' pentagon marker
'*' star marker
'h' hexagon1 marker
'H' hexagon2 marker
'+' plus marker
'x' x marker
'D' diamond marker
'd' thin_diamond marker
'|' vline marker
'_' hline marker
(2)
character color
‘b’ blue
‘g’ green
‘r’ red
‘c’ cyan
‘m’ magenta
‘y’ yellow
‘k’ black
‘w’ white
(3)
Property Description
agg_filter unknown
alpha float (0.0 transparent through 1.0 opaque)
animated [True | False]
antialiased or aa [True | False]
axes an Axes instance
clip_box a matplotlib.transforms.Bbox instance
clip_on [True | False]
clip_path [ (Path, Transform) | Patch | None ]
#color or c any matplotlib color
contains a callable function
dash_capstyle [‘butt’ | ‘round’ | ‘projecting’]
dash_joinstyle [‘miter’ | ‘round’ | ‘bevel’]
dashes sequence of on/off ink in points
drawstyle [‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’]
figure a matplotlib.figure.Figure instance
fillstyle [‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’]
gid an id string
#label string or anything printable with ‘%s’ conversion.
#linestyle or ls [‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
#linewidth or lw float value in points
#marker A valid marker style
#markeredgecolor or mec any matplotlib color
#markeredgewidth or mew float value in points
#markerfacecolor or mfc any matplotlib color
#markerfacecoloralt or mfcalt any matplotlib color
#markersize or ms float
markevery [None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]
path_effects unknown
picker float distance in points or callable pick function fn(artist, event)
pickradius float distance in points
rasterized [True | False | None]
sketch_params unknown
snap unknown
solid_capstyle [‘butt’ | ‘round’ | ‘projecting’]
solid_joinstyle [‘miter’ | ‘round’ | ‘bevel’]
transform a matplotlib.transforms.Transform instance
url a url string
visible [True | False]
xdata 1D array
ydata 1D array
zorder any number
[2] plt.hist
plt.hist(x, bins=10, range=None, normed=False, weights=None,cumulative=False,
bottom=None, histtype='bar', align='mid', orientation='vertical',
rwidth=None, log=False, color=None, label=None, stacked=False,
hold=None, data=None, **kwargs)
bins: 10
histtype : {‘bar’, ‘barstacked’, ‘step’, ‘stepfilled’}
align : {‘left’, ‘mid’, ‘right’}
orientation : {‘horizontal’, ‘vertical’}
color:
label:
~
import matplotlib.mlab as mlab
mu = 100 # mean of distribution
sigma = 15 # standard deviation of distribution
x = mu + sigma * np.random.randn(10000)
num_bins = 50
n, bins, patches = plt.hist(x, num_bins, normed=1, facecolor='green', alpha=0.5)
# add a 'best fit' line
y = mlab.normpdf(bins, mu, sigma)
plt.plot(bins, y, 'r--')
plt.xlabel('Smarts')
plt.ylabel('Probability')
plt.title(r'Histogram of IQ: $\mu=100$, $\sigma=15$')
# Tweak spacing to prevent clipping of ylabel
plt.subplots_adjust(left=0.15)
plt.show()
~
闪银
FICO评分
中文编码:
su = u"哈哈"
print su.encode('utf-8')
collections笔记:
a = `list`
from collections import Counter
Counter(a)
c = Counter(a=4, b=2, c=3, d=4)
list(c.elements())
GROUP_CONCAT(table,separator=',')