To facilitate the search and use of Python matplotlib the appropriate drawing settings interface, the common settings are written in the same code for easy reference, including:1. Setting of Chinese and special characters2, sub-chart, title, legend settings3, the name of the axis, scale, spacing and other settings4, the color of the line, style, width of the settingsCode GitHub Links: (to be added)#-*-codin
This article lists and describes Python's standard library and Third-party libraries as follows for reference to friends who need it:
Tkinter ———— Python's default graphical interface.Tkinter is a module with the TK interface, and the Tkinter library provides an interface to the TK API, which belongs to the TCL/TK GUI tool group. TCL/TK is a writing and graphics device developed by John Ousterhout. Tcl (To
coordinateY2,X2 represents the coordinates of the second control pointY3,X3 represents the third control point coordinateThe weight represents the weight of the middle control point and is used to control the curvature of the curve. from Import Draw,data Import Matplotlib.pyplot as pltimg=Data.chelsea () RR, CC=draw.bezier_curve (150,50,50,280,260,400,2) Draw.set_color (img,[rr,cc],[255, 0,0]) plt.imshow (Img,plt.cm.gray)6. Draw Hollow CircleAnd the previous circle is the same, but the front is
+ = solver.test_nets[0].blobs['SoftmaxWithLoss1'].data#Calculate test Accuracy_accuracy + = solver.test_nets[0].blobs['Accuracy1'].data#calculate average Test lossTest_loss[it/test_interval] = _test_loss/Test_iter#calculate average test accuracyTest_acc[it/test_interval] = _accuracy/Test_iter _test_loss=0 _accuracy=0#Draw train loss, test loss, and accuracy curvesPrint '\nplot the train loss and test accuracy\n'_, Ax1=plt.subplots () ax2=Ax1.twinx ()#train loss, greenAx1.plot (Display * Arange
Matplotlib is a powerful Python module for drawing two-dimensional graphics, which uses the Python language to achieve the ease of use of the MATLAB drawing function, while having a very powerful customization capability. It provides a complete set of command APIs similar to MATLAB and is ideal for interactive mapping.
This example describes the Python drawing method. Share to everyone for your reference. Specific as follows:
#-*-Coding:utf-8-*-import Matplotlib.pyplot as Pltdef main (): # Color list colorlist = [' B ', ' G ', ' R ', ' C ', ' m ', ' y ', ' k ' ] # Common horizontal threadlist = [1,2,4,8,10] # Set the horizontal and ordinate names plt.xlabel (' Threads ') Plt.ylabel (' Concurrent ') # g
Recently in the use of Pycharm Learning Python language, have to sigh the powerful and humanized python language!But for the use of pycharm drawing (more complex diagram) will need to use a few plug-ins, namely Matplotlib, NumPy and scipy! But Pycharm itself is not built-in, so you need to download and install it yourself! So all kinds of Baidu, a variety of sear
Python + matplotlib: code for drawing a 3D bar chart instance, pythonmatplotlib
The example shared in this article mainly implements Python + matplotlib to draw a 3D bar chart with shadow and no shadow, as shown below.
First, let's take a look at the demo:
The complete code is as follows:
Import numpy as npimport matplotlib. pyplot as pltfrom mpl_toolkits.m
= ' Happy birthday ", font= (" couried ",") "Nine, display picturesTo display a picture on the canvas with Tkinter, first load the picture, and then use the create_image function on the canvas object.This is a picture of my existence on the E disk:We can show one.gif pictures like this: from import*>>> tk = tk ()>>> canvas = canvas (tk,width=400,height=400)> >> canvas.pack ()>>> my_image = photoimage (file='e:\\ffoutput\\one.gif ' )>>> canvas.create_image (0,0,anchor = Nw,image = my_image
the name of the Chinese font manually.Manually add the following code[Python]View PlainCopy
From Pylab Import *
mpl.rcparams[' font.sans-serif '] = [' Simhei ']
The source code is modified as follows:[Python]View PlainCopy
Import Matplotlib.pyplot as Plt
From Pylab Import *
mpl.rcparams[' font.sans-serif '] = [' Simhei ']
# define text box and arrow formatting
Decisio
the name of the Chinese font manually.Manually add the following code[Python]View PlainCopy
From Pylab Import *
mpl.rcparams[' font.sans-serif '] = [' Simhei ']
The source code is modified as follows:[Python]View PlainCopy
Import Matplotlib.pyplot as Plt
From Pylab Import *
mpl.rcparams[' font.sans-serif '] = [' Simhei ']
# define text box and arrow formatting
Decisio
Python Seaborn Drawing[Email protected] 2017.08.02There are too many ways to draw, I do not know what the situation with the good?These things are seaborn used to draw according to the loaded data, matplotlib can also drawImport Seaborn as SNSSns.set (style= "Whitegrid", Color_codes=true)This is the property that sets the artboardDistplot ()Lmplot ()Kdeplot () Draw curve, parabolaResidplot residual curveJoi
def get_cdf (numlist):p rint "Total number of numlist%d"%len (numlist) Numarray = Np.asarray (numlist) dx =. 01bins_array = NP. Arange ( -0.5,1.5,DX) hist, bin_edges = Np.histogram (Numarray, Bins=bins_array, normed=false) CDF = Np.cumsum (hist) CDF = Cdf/float (Hist.sum ()) Bins_list = Bins_array[1:]return (bins_list, CDF)Toss for a long time, before writing a painting histogram map code, but found that if you want to draw two list words, there will be problems, their subscript can not be unifi
When we follow the previous blog post
http://blog.csdn.net/tao_627/article/details/44004541
After you have configured your Python drawing environment, here are a few representative examples:
I. Drawing of a bar chart
#!/usr/bin/env_python
#encoding: utf-8
import Matplotlib.pyplot as PLT
def bar_chart_generator ():
l =[1,2,3,4,5]
h=[20,14,38,27,9]
w
ImportMatplotlib.pyplot as Plt#The slices would be ordered and plotted counter-clockwise.Labels ='Frogs','Hogs','Dogs','Logs'Sizes= [15, 30, 45, 10]colors= ['Yellowgreen','Gold','Lightskyblue','lightcoral']explode= (0, 0.1, 0, 0)#Only "Explode" the 2nd slice (i.e. ' hogs ')Plt.pie (sizes, explode=explode, Labels=labels, colors=colors,autopct='%1.1f%%', Shadow=true, startangle=90)#Set aspect ratio to being equal so, pie is drawn as a circle.Plt.axis ('Equal') Plt.savefig ('D:\\pie.png') plt.show
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.