Python Matplotlib Notes

Source: Internet
Author: User

There are many visual tools, such as tableau, a variety of JS framework, I personally feel it should be the best to learn JS, because JS does not need the environment, every computer has a browser, and like matplotlib need a development environment such as python, or more troublesome, But after all, using Python to process the data, this article is to write some of their own study notes, of course, know what the most important painting (I do not know-.) -)!

Try to draw two-dimensional, not three-dimensional. If the age of the two-dimensional map, more pay, you can make the point of high-paying water to draw a large point, color deep.

Text Visualization (Word cloud Word map, theme flow label amount, emotion visualization positive negative, etc.)

Timing Visualization (Financial time series)

High-dimensional visualization, parallel coordinate method, not perpendicular to Cartesian coordinates x, Y axis.

is reflected by the connection of the line.

Visualization of social network diagrams.

Scientific visualization, high-performance computing is very common, the volume is particularly large, such as typhoons, cloud mobile real-time rendering.

Matplotlib
Import Matplotlib.pyplot as Pltimport numpy as Npx = Np.linspace ( -1,2,50) y = 2*x + 2y2 = X**2plt.xlim (( -1,2))  #x, y range P Lt.ylim (( -2,3)) Plt.xlabel (' I am X ')  #设置坐标轴的名字plt. Ylabel (' I am y ') L1, = plt.plot (X,y,color = ' red ', LineWidth = 1.0, Li Nestyle = '--', label= ' up ')  #legend为设置图例, if you want to pass handle L1,L2 must add a comma, labels can overwrite l1,l2 name, l2, = plt.plot (X,y2,label = ' Down ') #loc can be best let him choose, or you can set Plt.legend (handles = [L1,l2],labels = [' aaa ', ' bbb '],loc = ' best ') # plt.show () New_ticks = Np.linspace ( -1,2,5) plt.xticks (new_ticks) plt.yticks ([ -2.-1.5,-1,1,3],[r ' really bad ', R ' bad ', R ' normal ', R ' good ', R ' really good ']) # plt.show () ax = PLT.GCA () ax.spines[' right '].set_color (' none ') #四个框, set and the upper box is colorless ax.spines[' top '].set_color (' None ') ax.xaxis.set_ticks_position (' Bottom ') ax.yaxis.set_ticks_position (' Left ') ax.spines[' Bottom '].set_position ((' Data ', -1)) ax.spines[' left '].set_position ((' data ', 0)) Plt.show ()

  

In fact, matplotlib images are in a figure canvas, and plt.figure is used to create a new canvas. And I'm not plt.figure, but directly plt.plot, that's because plot will get the current axes object through PLT.GCA (), and if it's not created automatically then call the Axes object's plot method to paint. For Pyplot, it holds the current chart and sub-graph information, which can be handled by PLT.GCF (get current figures) and PLT.GCA (get present axes), and the function is processed on the currently figure or axes object.

Refer to Http://www.cnblogs.com/nju2014/p/5620776.html (detailed image sections)

and http://www.cnblogs.com/NaughtyBaby/p/5533855.html

About all kinds of bars, scatter, and the like figure http://www.cnblogs.com/jasonfreak/p/5441512.html (descriptive statistics in Python)

Python Matplotlib Notes

Related Article

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.