-
Notifications
You must be signed in to change notification settings - Fork 19
/
mpl_kwargs.py
141 lines (137 loc) · 2.5 KB
/
mpl_kwargs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# this is a list of options to Line2D partially taken from
# https://github.com/matplotlib/matplotlib/blob/f9d29189507cfe4121a231f6ab63539d216c37bd/lib/matplotlib/lines.py#L271
# many of these can also be made into functions
# also taken from the docstring of plt.axvline which lists all the properties of Line2D
Line2D_kwargs_list = [
"agg_filter",
"alpha",
"animated",
"antialiased",
"aa",
"clip_box",
"clip_on",
"clip_path",
"color",
"c",
"contains",
"dash_capstyle",
"dash_joinstyle",
"dashes",
"data",
"drawstyle",
"ds",
"figure",
"fillstyle",
"gid",
"in_layout",
"label",
"linestyle",
"ls",
"linewidth",
"lw",
"marker",
"markeredgecolor",
"mec",
"markeredgewidth",
"mew",
"markerfacecolor",
"mfc",
"markerfacecoloralt",
"mfcalt",
"markersize",
"ms",
"markevery",
"path_effects",
"picker",
"pickradius",
"rasterized",
"sketch_params",
"snap",
"solid_capstyle",
"solid_joinstyle",
"transform",
"url",
"visible",
"xdata",
"ydata",
"zorder",
]
imshow_kwargs_list = [
"cmap",
"norm",
"aspect",
"interpolation",
"alpha",
"vmin",
"vmax",
"origin",
"extent",
"filternorm",
"filterrad",
"resample",
"url",
]
Text_kwargs_list = [
"agg_filter",
"alpha",
"animated",
"backgroundcolor",
"bbox",
"clip_box",
"clip_on",
"clip_path",
"color",
"c",
"contains",
"figure",
"fontfamily",
"family",
"fontproperties",
"font_properties",
"fontsize",
"size",
"fontstretch",
"stretch",
"fontstyle",
"style",
"fontvariant",
"variant",
"fontweight" "weight",
"gid",
"horizontalalignment" "ha",
"in_layout",
"label",
"linespacing",
"multialignment" "ma",
"path_effects",
"picker",
"position",
"rasterized",
"rotation",
"rotation_mode",
"sketch_params",
"snap",
"text",
"transform",
"url",
"usetex",
"verticalalignment" "va",
"visible",
"wrap",
"x",
"y",
"zorder",
]
def kwarg_popper(kwargs, mpl_kwargs):
"""
This will not modify kwargs for you.
Examples
--------
kwargs, plot_kwargs = kwarg_popper(kwargs, plot_kwargs_list)
"""
kwargs = dict(kwargs)
passthrough = {}
for k in mpl_kwargs:
if k in kwargs:
passthrough[k] = kwargs.pop(k)
return kwargs, passthrough