Matplotlib Paint Plot Style setup

Source: Internet
Author: User
This article is a little note about learning the matplotlib for Python developers
You can set line parameters when plot paint. Includes: color, line style, marking styles.
1) Control color
The corresponding relationship between colors is
b---blue c---cyan g---green k----black
M---magenta r---red w---white y----yellow
There are three ways of representing colors:
A: B:16 with full name: #FF00FF C:rgb or Rgba tuple (1,0,1,1) d: Grayscale intensity such as: ' 0.7 '
2) control line style
The correspondence between the symbol and the line style
-Solid Line
--Short-term
-. Short Point interphase Line
: Virtual Point line

3) control tag style
There are a variety of tag styles:
. Point marker
, Pixel Marker
o Circle Marker
V Triangle down Marker
^ Triangle up marker
< triangle left Marker
> Triangle Right Marker
1 Tripod down Marker
2 Tripod up Marker
3 Tripod left Marker
4 Tripod Right Marker
S Square Marker
P Pentagon Marker
* Star Marker
H Hexagon Marker
H rotated hexagon D Diamond Marker
D Thin Diamond Marker
| Vertical Line (Vlinesymbol) marker
_ Horizontal line (hline symbol) marker
+ Plus Marker
x Cross (x) marker
The following example sets the above three: the specific code and effect are as follows:
[Python]View Plain copy import Matplotlib.pyplot as PLT import numpy as np y = Np.arange (1, 3, 0.3) Plt.plot (y, ' cx--'),   Y+1, ' Mo: ', y+2, ' kp-'); Plt.show ()



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.