Common knowledge of Matplotlib library

Source: Internet
Author: User
Tags dashed line

Matplotlib is a 2D drawing library on Python that can produce many high-quality images on top of the platform. The aim is to make simple things easier and make complex things possible. We can use Matplotlib to generate plots, histograms, power spectra, histogram, error plots, scatter plots, and so on.

Matplotlib was invented by John Hunter (1968-2012), and unfortunately he has died in the syndrome caused by cancer therapy. A great generation has many contributions, and we must remember him. If we benefit greatly from his contribution, consider contributing your strength to John Hunter Technology Fellowship.

Below we are learning based on the matplotlib version of 1.5.3.

Matplotlib in the future work and study has a great use, it is necessary to learn the system.

Let's start with a simple drawing:

Plot (*args, *kwargs) function, which can draw a very simple line graph, basic usage:

Plot (x, y)        #  draw a graph with a horizontal axis of x and a vertical y, using the default line and color;'bo')  #  In blue, and dot mark with small circle, below will explain Oh plot (y)           #  vertical axis with Y, horizontal axis with y of each element of the coordinates, namely 0,1,2 ... ' r+ ')     #
#如果其中x或y is 2D, it will use its corresponding each column to indicate Oh, is each row oh, is each column oh, is each column oh, (important thing say three times)
Plot (x1, y1, ' g^ ', x2, y2, ' g ') #看到了吗, we can use many pairs of x, y, format pairs as variables of oh, to draw them in a picture;

For parameters, commonly used format: line color, line shape, point marker shape, we use these three times often with abbreviations, the order between them can be Oh,

As they two one meaning:'r+--','+--r'. If we do not want abbreviations, we can write them as: color= ' green ', linestyle= ' dashed ', marker= ' o '.

The shape of the line:

' - '     solid line style'--'    dashed line style'-. '    dash-dot line style':'    dotted line style

Mark of Point:

'.'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

Color of the line:

' B '    blue ' g '    green ' r '    red ' C '    cyan ' m '    Magenta ' y '    yellow ' k '    black ' W '    White

Common line properties are: Color,labor,linewidth,linestyle,maker, etc., specifically to see the whole words, see: http://matplotlib.org/api/lines_api.html# Matplotlib.lines.Line2D.

See an example:

ImportMatplotlib.pyplot as PltImportNumPy as Npplt.figure (1)#call the figure function to create a figure (1) object, you can omit, so that plot, it will automatically build one;T= Np.arange (0.0, 2.0, 0.1) s= Np.sin (2*np.pi*t) Plt.plot (t, S,'R--o', label ='Sinx') plt.legend ()#Displays the label in the upper- right corner, which is the label above = ' Sinx 'Plt.xlabel ('Time (s)')#sets the label of the x-axis;Plt.ylabel ('Voltage (MV)')#sets the label for the y-axis;Plt.title ('About as simple as it gets, folks') Plt.grid (True)#display grid;plt.show ()#show figure;

Draw a positive picture:

shared_ptr<net<dtype> > net_;
vector<shared_ptr<net<dtype> > > test_nets_;

Net.blobs is a dictionary element:

Key: Network name for each layer of network

Value: For a blob oh, you can return Data,diff, count, shape

Net.params is a dictionary element;

Key: For each layer has the parameter name,

Value: Vetcor for a blob oh; the first element in the vector is the main one, and the second element has nothing to do with it.

Common knowledge of Matplotlib library

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.