Commit 8c3fd5e
committed
Set the dpi with figure.dpi instead of savefig.dpi
This makes changing the dpi more straight forward and
controllable within a context.
For example, the code below now works as expected.
```python
with mpl.rc_context():
mpl.rcParams['figure.dpi'] = 200
mpl.rcParams['figure.figsize'] = (6, 4)
ax = plt.subplot(111)
ax.scatter([1, 2], [1, 2])
```
Without this commit and the accompanying commit in `ipython`,
the `dpi` would be queried directly from the `rcParams` and
this would happen outside the context. With this commit,
Matplotlib creates a figure with the correct `dpi` as a property
and `ipython` will always use that or modify it accordingly.
Also by using `savefig.dpi`, the internal workings of the backend
were slipping into userspace. `InlineBackend` uses the same method
as used for saving but as far as the user is concerned, what is
happening is an image-display not an image-save.1 parent 3a7c48d commit 8c3fd5e
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
0 commit comments