Drawing matplotlib with word cloud python reptile of (seven)

1 Draw a bar graph

13406307-e54cfa8efa2cc424.png

2 post position draw Zhaopin amount map

13406307-09e434de6fc799d7.png

3 word cloud

"Word cloud" concept, specializing in new media director Rich Gordon (Rich Gordon) made by Associate Professor of Journalism at Northwestern University. "Word cloud" is a higher frequency of occurrence "keywords" web text to be highlighted for visual form a "keyword cloud" or "keyword rendered" to filter out a lot of text messages, browse the web as long as the a sweep of text you can enjoy the gist of the text.

Frequencies

Word sentence cut

13406307-c3f3bd0ada7e1cc7.png

Reading text

13406307-4bd30e2a1d172b82.png

Cutting

13406307-53376a0e8bc0b16e.png

Streamline the generation word cloud

13406307-913776bc76dd190c.png

Drawing 4 Matplotlib

More than one subplot

13406307-d956b1e062885f3f.png

13406307-3e8cf3d69ebdf586.png

FIG line 2

13406307-e598c46b4905da32.png


13406307-2cfa4653c8c438de.png

Code as follows:

The first array is a plot function of the value of the horizontal axis, the longitudinal axis of the second array value, which is a straight line, a polyline;

The last parameter is constituted by two characters, respectively, line style and color. The former is a straight red, which is the green dotted line.

3 Scatter

13406307-1d211704170bcda6.png


13406307-6d29ba7fdb576439.png

Code as follows:

This figure includes three sets of data, each set of data contains the coordinates of the 20 random positions

Parameter c represents the color point, s is the size of the dots, alpha transparency

Pie Chart 4

13406307-765abf48a6e743ce.png


13406307-f0788c6cc5f938a5.png

Code as follows:

Numerical data is a set of random data comprising 7

FIG specified by the tag labels

autopct precision format specified value

plt.axis ( 'equal') provided a consistent size axis

plt.legend () indicates the legend to be drawn (top right of figure below)

5 bar

13406307-5a82b07b4ae326bc.png

13406307-d878a1eb44d7bdfe.png

Code as follows:

This figure shows a set of results comprising 7 random values, each value is [0, 100] of the random number

Their color is generated using a random number. np.random.rand (N * 3) .reshape ( N, -1) indicates Mr. as 21 (N x 3) random numbers, and then assemble them into 7 lines, then each row is the number three, which corresponds to the three components of the color. If you do not understand this line of code, please learn about Python machine learning library NumPy Tutorial

title specifies the title graphics, labels specify the label, alpha transparency

6 Histogram

13406307-8988dbbe3538cc02.png


13406307-ae6312c9bb255272.png

In the above code, [np.random.randint (0, n, n) for n in [3000, 4000, 5000]] generated array contains three arrays, of which:

The first array contains 3,000 random numbers, the random numbers range is [0, 3000)

The second array contains 4,000 random numbers, the random numbers range is [0, 4000)

The third array contains 5,000 random numbers, the random numbers range is [0, 5000)

Reproduced in: https: //www.jianshu.com/p/f43e3ef31770

Guess you like

Origin blog.csdn.net/weixin_33696106/article/details/91073215