Matplotlib 기초 이해하기_20160730
-
Upload
yong-joon-moon -
Category
Software
-
view
1.329 -
download
19
Transcript of Matplotlib 기초 이해하기_20160730
PowerPoint
MatplotlibMoon Yong Joon
MatPLOTLIBpyplot
Moon Yong Joon
x,y
YX
matplotlib index x, y
jupyter
jupyter notebook %matplotlib inline jupyter notebook
plot x,y, 3 3
y = x y = x**2 y = x**3
Plot
1 : Line2D plot list Line2D object plot list
2 : Line2D 2 plot
3 : Line2D plot 3 list Line2D 3
Text
:Text ylabel Text object
/
1 Figure
2 Figure
3 plot
Seaborn
Seaborn seaborn
Seaborn install docker seaborn pip docker exec {} pip install seaborn --upgrade
MatPLOTLIBpyplotplot
Moon Yong Joon
plot : 1 y plot x
plot : 2 y plot x marker
plot : x y 1 x y
plot : x y 2 x y
plot : plot 2
plot : marker marker +
plot :marker 1Plot solid(r-), dash(r)
soliddash
plot : marker 2 plot circle marker(ro)
plot :marker Plot marker
r-- : red dash bs : blue square g^ : green triangle
plot : marker keyword Plot marker
plot : labelPlot legend label
legend
plot : linewidthPlot line linewidth
Line2D
Line2D property Line2D property
setp Line2D
Axes
Figure/Axes
Axes
Axes set_xlim, set_ylim, xlabel, ylabel, title
, label,
tight_layout Text
tight_layout Text
MatPLOTLIBpyplot scatter
Moon Yong Joon
scatter : PathCollection object 10 2
scatter : s , c , marker
MatPLOTLIBpyplotbar
Moon Yong Joon
bar : bar 0.8,
bar : bar
bar : bar 0.5
bar : bar 0.33
MatPLOTLIBpyplotbarh
Moon Yong Joon
barh : m_pop minus (-)
-m_pop
MatPLOTLIBpyplotPie
Moon Yong Joon
pie : colors=('b', 'g', 'r', 'c', 'm', 'y', 'k', 'w')
pie : labels labels
MatPLOTLIBpyplothisto
Moon Yong Joon
hist : xlabel
hist : 1 15
hist : 2 20
hist :
hist : normed 1, facecolor , alpha
hist : facecolor red
hist : alpha 0.4
hist : 1 normed 1 1
hist : histtype histtype stepfilled
Axes
Axes.hist hist Cumulative
MatPLOTLIBpyplotboxplot
Moon Yong Joon
box
Axes.boxplot boxplot
boxplot boxplot
Axes
Axes.boxplot boxplot
MatPLOTLIBpyplotimage plot
Moon Yong Joon
isshow() imshow() colorbar colorbar
image.read ndarray imshow
axis(off)
MatPLOTLIBpyplotlogplot
Moon Yong Joon
log
subplot 2 Axes Axes 2 2
semilogy/loglog log
MatPLOTLIBTwo-dimensional plots Moon Yong Joon
Contour plots
meshgrid 2 ndarray
Contour plots Contour plots
MaTPLOTLIB
Moon Yong Joon
Basic text commands
Basic text commands Basic text commands
text
text :
text : text Text
text : 1 text (va: top, bottom, center, baseline), (ha :center, right, left')
text : 2 text
text :latex latex
text : text text
title
title :
title : font/color Latex fontsize color
label
ylabel : label y
xlabel : label x
xlabel : font/color x label fontsize font color
annotate
annotate : annotate , xy( ), xytext( ), arrowpros()
xycoords/textcoords :1 axes fraction xy 1 1
xycoords/textcoords : xycoords/textcoords
argumentcoordinate systemfigure pointspoints from the lower left corner of the figurefigure pixelspixels from the lower left corner of the figurefigure fraction0,0 is lower left of figure and 1,1 is upper rightaxes pointspoints from lower left corner of axesaxes pixelspixels from lower left corner of axesaxes fraction0,0 is lower left of axes and 1,1 is upper rightdatause the axes data coordinate system
annotate : annotate
annotate : arrowprosarrowpros() Polygon arrowpropskeydescriptionwidththe width of the arrow in pointsfracthe fraction of the arrow length occupied by the headheadwidththe width of the base of the arrow head in pointsshrinkmove the tip and base some percent away from the annotated point and text**kwargsany key formatplotlib.patches.Polygon, e.g.,facecolor
matplotlib.patches.Polygon,
Method
Figure Figure
Figure :
MaTPLOTLIB
Moon Yong Joon
figure/subplot
figure : figure Figure
subplot : 1
subplot : 2
figure/subplot :
figure/subplot: subplot
Figure class
add_subplot/add_axes Figure 2 Axes
Axes ax1 plot . ax1.lines[0]
label Axes ax1 set_xlabel, set_ylabel
del ax1.lines[0], ax1.lines.remove(line)
MaTPLOTLIB
Moon Yong Joon
axis
axis axis 2 x, 2 y
ticks
ticks : xticks, yticks
limit
lim : xlim, ylim
scale
scale : yscale yscale y
legend
2 plot , label
plot(label) : 1 plot label
plot(label) : 2 plot label
legend
MaTPLOTLIB
Moon Yong Joon
plot : file file Plot
savefig PDF
Docker jupyter notebok
Moon Yong Joon
Windows
widndows windows docker
1. 64-bit .2. 7 .3. OS (Virtualization) .
widndows7 docker browser Tool
Docker
docker docker virtualbox https://www.docker.com/products/docker-toolbox
docker : docker Docker Quickstart Terminal
docker : vdocker docker-machine vdocker $ docker-machine create vdocker -d virtualbox
docker-machien docker-machine vdocker
docker-machien : error docker-machine vdocker error rm
Docker
windows :docker cmd prompt (Docker Quickstart Terminal ) .FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd vdocker') DO %i
Docker
windows :docker Docker Quickstart Terminal .
docker run -it b.gcr.io/tensorflow/tensorflow:latest-devel
tensorflow .
Jupyter notebook
tensorflow docker terminal docker run -p 8888:8888 -p 6006:6006 -it b.gcr.io/tensorflow/tensorflow docker 8888(jupyter notebook), 6006(tensorboard)
jupyter notebook http://192.168.99.100:8888/
Python moduleinstall/upgradeMoon Yong Joon
Python
Jupyter notebook !pip list (docker docker python )
Python
Docker docker ps a
Docker docker exec {} {pip }
Jupyter notebook !pip install {} upgrade