绘制图线和数据点的样式风格和颜色表大全
1、legend()
显示坐标轴中图线的对应标注的显示位置
plt.legend(loc)
loc | loc code |
---|
’best’ (default) | 0 |
upper right | 1 |
upper left | 2 |
lower left | 3 |
lower right | 4 |
right | 5 |
center left | 6 |
center right | 7 |
lower center | 8 |
upper center | 9 |
2、linestyle
linestyle='字符'
字符 | 风格字符 |
---|
- | (默认)实线 |
– | 虚线 |
-. | 点划线 |
: | 点虚线 |
’' | 留空、空格 |
3、marker
设置marker形式: marker='字符'
设置marker大小: markersize=10
Mathtext marker采样的是 Latex 公式格式
4、linestyle和marker的区别
linestyle是图形中图线的风格,而marker是数据点的样式风格。
5、color对照表
字符 | 颜色 |
---|
r | 红色 |
g | 绿色 |
b | 蓝色 |
w | 白色 |
c | 青色 |
m | 洋红 |
y | 黄色 |
k | 黑色 |
字符 | 颜色 |
---|
tab:blue | tab:蓝色 |
tab:orange | tab:橙色 |
tab:green | tab:绿色 |
tab:red | tab:红色 |
tab:purple | tab:紫色 |
tab:brown | tab:棕色 |
tab:pink | tab:粉红色 |
tab:gray | tab:灰色 |
tab:olive | tab:橄榄色 |
tab:cyan | tab:青色浅绿色 |
color: hexcode | color: hexcode | color: hexcode | color: hexcode |
---|
black: #000000 | bisque: #FFE4C4 | forestgreen: #228B22 | slategrey: #708090 |
dimgray: #696969 | darkorange: #FF8C00 | limegreen: #32CD32 | lightsteelblue: #B0C4DE |
dimgrey: #696969 | burlywood: #DEB887 | darkgreen: #006400 | cornflowerblue: #6495ED |
gray: #808080 | antiquewhite: #FAEBD7 | green: #008000 | royalblue: #4169E1 |
grey: #808080 | tan: #D2B48C | lime: #00FF00 | ghostwhite: #F8F8FF |
darkgray: #A9A9A9 | navajowhite: #FFDEAD | seagreen: #2E8B57 | lavender: #E6E6FA |
darkgrey: #A9A9A9 | blanchedalmond: #FFEBCD | mediumseagreen: #3CB371 | midnightblue: #191970 |
silver: #C0C0C0 | papayawhip: #FFEFD5 | springgreen: #00FF7F | navy: #000080 |
lightgray: #D3D3D3 | moccasin: #FFE4B5 | mintcream: #F5FFFA | darkblue: #00008B |
lightgrey: #D3D3D3 | orange: #FFA500 | mediumspringgreen: #00FA9A | mediumblue: #0000CD |
gainsboro: #DCDCDC | wheat: #F5DEB3 | mediumaquamarine: #66CDAA | blue: #0000FF |
whitesmoke: #F5F5F5 | oldlace: #FDF5E6 | aquamarine: #7FFFD4 | slateblue: #6A5ACD |
white: #FFFFFF | floralwhite: #FFFAF0 | turquoise: #40E0D0 | darkslateblue: #483D8B |
snow: #FFFAFA | darkgoldenrod: #B8860B | lightseagreen: #20B2AA | mediumslateblue: #7B68EE |
rosybrown: #BC8F8F | goldenrod: #DAA520 | mediumturquoise: #48D1CC | mediumpurple: #9370DB |
lightcoral: #F08080 | cornsilk: #FFF8DC | azure: #F0FFFF | rebeccapurple: #663399 |
indianred: #CD5C5C | gold: #FFD700 | lightcyan: #E0FFFF | blueviolet: #8A2BE2 |
brown: #A52A2A | lemonchiffon: #FFFACD | paleturquoise: #AFEEEE | indigo: #4B0082 |
firebrick: #B22222 | khaki: #F0E68C | darkslategray: #2F4F4F | darkorchid: #9932CC |
maroon: #800000 | palegoldenrod: #EEE8AA | darkslategrey: #708090 | darkviolet: #9400D3 |
darkred: #8B0000 | darkkhaki: #BDB76B | teal: #008080 | mediumorchid: #BA55D3 |
red: #FF0000 | ivory: #FFFFF0 | darkcyan: #008B8B | thistle: #D8BFD8 |
mistyrose: #FFE4E1 | beige: #F5F5DC | aqua: #00FFFF | plum: #DDA0DD |
salmon: #FA8072 | lightyellow: #FFFFE0 | cyan: #00FFFF | violet: #EE82EE |
tomato: #FF6347 | lightgoldenrodyellow: #FAFAD2 | darkturquoise: #00CED1 | purple: #800080 |
darksalmon: #E9967A | olive: #808000 | cadetblue: #5F9EA0 | darkmagenta: #8B008B |
coral: #FF7F50 | yellow: #FFFF00 | powderblue: #B0E0E6 | fuchsia: #FF00FF |
orangered: #FF4500 | olivedrab: #6B8E23 | lightblue: #ADD8E6 | magenta: #FF00FF |
lightsalmon: #FFA07A | yellowgreen: #9ACD32 | deepskyblue: #00BFFF | orchid: #DA70D6 |
sienna: #A0522D | darkolivegreen: #556B2F | skyblue: #87CEEB | mediumvioletred: #C71585 |
seashell: #FFF5EE | greenyellow: #ADFF2F | lightskyblue: #87CEFA | deeppink: #FF1493 |
chocolate: #D2691E | chartreuse: #7FFF00 | steelblue: #4682B4 | hotpink: #FF69B4 |
saddlebrown: #8B4513 | lawngreen: #7CFC00 | aliceblue: #F0F8FF | lavenderblush: #FFF0F5 |
sandybrown: #F4A460 | honeydew: #F0FFF0 | dodgerblue: #1E90FF | palevioletred: #DB7093 |
peachpuff: #FFDAB9 | darkseagreen: #8FBC8F | lightslategray: #778899 | crimson: #DC143C |
peru: #CD853F | palegreen: #98FB98 | lightslategrey: #778899 | pink: #FFC0CB |
linen: #FAF0E6 | lightgreen: #90EE90 | slategray: #708090 | lightpink: #FFB6C1 |
参考