-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Commit e54d46e
Make it possible to use rc_context as a decorator.
See changelog note.
There are also other advantages with contextmanager, e.g. reusing a
context multiple times works
```
ctx = rc_context(...)
with ctx: ... # in the context
... # out of the context
with ctx: ... # in the context again
```
(with a test for the decorator form, which is equivalent) but in
practice this will often run into the issue of early/late resolution of
rcParams, so I didn't mention it in the changelog.
xkcd() still needs to be implemented manually in terms of
`__enter__`/`__exit__` but at least we know that creation of the
contextmanager cannot fail, so things are simpler.
Also we don't need to check for whether the backend has been
resolved because rcParams now just prevent re-setting the backend to
auto_backend_sentinel.1 parent 19d589c commit e54d46e
File tree
5 files changed
+77
-66
lines changed- doc/users
- next_whats_new
- prev_whats_new
- lib/matplotlib
- tests
5 files changed
+77
-66
lines changedLines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | + | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | + | ||
11 | + |
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
86 | 86 |
| |
87 | 87 |
| |
88 | 88 |
| |
89 | - | ||
89 | + | ||
90 | 90 |
| |
91 | 91 |
| |
92 | 92 |
| |
|
Lines changed: 14 additions & 38 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1140 | 1140 |
| |
1141 | 1141 |
| |
1142 | 1142 |
| |
1143 | - | ||
1143 | + | ||
1144 | + | ||
1144 | 1145 |
| |
1145 | 1146 |
| |
1146 | 1147 |
| |
| |||
1157 | 1158 |
| |
1158 | 1159 |
| |
1159 | 1160 |
| |
1160 | - | ||
1161 | - | ||
1162 | - | ||
1161 | + | ||
1162 | + | ||
1163 | 1163 |
| |
1164 | - | ||
1164 | + | ||
1165 | 1165 |
| |
1166 | 1166 |
| |
1167 | 1167 |
| |
1168 | 1168 |
| |
1169 | 1169 |
| |
1170 | - | ||
1171 | - | ||
1172 | - | ||
1173 | - | ||
1174 | - | ||
1175 | - | ||
1176 | - | ||
1177 | - | ||
1178 | - | ||
1179 | - | ||
1180 | - | ||
1181 | - | ||
1182 | - | ||
1183 | - | ||
1184 | - | ||
1185 | - | ||
1186 | - | ||
1187 | - | ||
1188 | - | ||
1189 | - | ||
1190 | - | ||
1191 | - | ||
1192 | - | ||
1193 | - | ||
1194 | - | ||
1195 | - | ||
1196 | - | ||
1197 | - | ||
1198 | - | ||
1199 | - | ||
1200 | - | ||
1201 | - | ||
1202 | - | ||
1170 | + | ||
1171 | + | ||
1172 | + | ||
1173 | + | ||
1174 | + | ||
1175 | + | ||
1176 | + | ||
1177 | + | ||
1178 | + | ||
1203 | 1179 |
| |
1204 | 1180 |
| |
1205 | 1181 |
| |
|
Lines changed: 43 additions & 27 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
339 | 339 |
| |
340 | 340 |
| |
341 | 341 |
| |
342 | - | ||
343 | - | ||
344 | - | ||
342 | + | ||
343 | + | ||
345 | 344 |
| |
346 | 345 |
| |
347 | - | ||
346 | + | ||
348 | 347 |
| |
349 | 348 |
| |
350 | 349 |
| |
| |||
371 | 370 |
| |
372 | 371 |
| |
373 | 372 |
| |
374 | - | ||
375 | - | ||
376 | - | ||
377 | - | ||
378 | - | ||
379 | - | ||
380 | - | ||
381 | - | ||
382 | - | ||
383 | - | ||
384 | - | ||
385 | - | ||
386 | - | ||
387 | - | ||
388 | - | ||
389 | - | ||
390 | - | ||
391 | - | ||
392 | - | ||
393 | - | ||
394 | - | ||
395 | - | ||
396 | - | ||
373 | + | ||
374 | + | ||
375 | + | ||
376 | + | ||
377 | + | ||
378 | + | ||
379 | + | ||
380 | + | ||
381 | + | ||
382 | + | ||
383 | + | ||
384 | + | ||
385 | + | ||
386 | + | ||
387 | + | ||
388 | + | ||
389 | + | ||
390 | + | ||
391 | + | ||
392 | + | ||
393 | + | ||
394 | + | ||
395 | + | ||
396 | + | ||
397 | + | ||
398 | + | ||
399 | + | ||
400 | + | ||
401 | + | ||
402 | + | ||
403 | + | ||
404 | + | ||
405 | + | ||
406 | + | ||
407 | + | ||
408 | + | ||
409 | + | ||
410 | + | ||
411 | + | ||
412 | + | ||
397 | 413 |
| |
398 | 414 |
| |
399 | 415 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
54 | 54 |
| |
55 | 55 |
| |
56 | 56 |
| |
57 | + | ||
58 | + | ||
59 | + | ||
60 | + | ||
61 | + | ||
62 | + | ||
63 | + | ||
64 | + | ||
57 | 65 |
| |
58 | 66 |
| |
59 | 67 |
| |
|
0 commit comments