[Matplotlib] a better understanding and add the necessary part on your map

A. Learn more about the figure and axes

Before I learned in the laboratory building, figure painting and axes are equivalent when the relationship between the drawing board and canvas . In general, you can only create a drawing board, but can have multiple canvas on a drawing board.

There is also a method to understand, we need to do more in-depth explanation of the axes of the object.

We all know that English is the axis of the Axis, axes fact, the plural form of the word .

matplotlib axes used to represent your drawing area - in other words, using the coordinate axis of a region surrounded by a drawing where you represented.

 

II. A figure which add more than one map

When we demo demo, or do other things that may need to draw more than one map on a drawing board.

Then we can:

  1.  Create a drawing board object. --plt.figure ()
  2.  Adding canvas --fig.add_subplot on the drawing board Object () to achieve

add_subplot has three parameters, we assume that we use add_subplot (a, b, c).

The meaning of these parameters are:

  1.  a: on the drawing board we add the number of rows in the array canvas
  2.  b: We are on the drawing board to add the number of columns array of canvas
  3.  c: I now numbered canvas canvas operations in the array .

Personally I think that this is really more awkward wording. Because every time I add the canvas at all times to write again the shape of the canvas of the array . The match canvas array behind the previous add fruit corresponding to the canvas, then the foregoing are invalid . To be honest, when creating the figure would be making a good array of canvas.

 

III. Modify your axes

· Setting coordinate axes x and y axes true scope

plt.xlim(xmin=?, xmax=?)

plt.ylim(ymin=?, ymax=?)

• Set the axis scale

ax.set_xticks([0, 250, 500, 750, 1000])
ax.set_yticks([0, 250, 500, 750, 1000])

· Setting angle and axis scale labels

ax.set_xticklabels(['one', 'two', 'three', 'four','five'], rotation=30, fontsize='small')

(Note distinguished from the previous one, is based here on a graduated, on the scale of further modifications )

· Set the entire label axis

ax.set_xlabel(?)

IV. Other

(A) Give your picture settings title

Use ax.set_title () method, not described in detail here started.

(B) With respect to plt.show ()

In REPL environment, plt.show () will be cleared before you paint the picture . This point to note.

 

Published 137 original articles · won praise 19 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_43338695/article/details/103219962