Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a9530f6

Browse files
committed
DOC: add non-linear scales blurb to main whats-new
1 parent ab978b8 commit a9530f6

File tree

2 files changed

+42
-39
lines changed

2 files changed

+42
-39
lines changed

doc/users/whats_new.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,48 @@ setting the private member ``_image_skew_coordinate`` has been
212212
removed. Instead, images will obey the transform of the axes on which
213213
they are drawn.
214214

215+
Non-linear scales on image plots
216+
````````````````````````````````
217+
218+
:func:`imshow` now draws data at the requested points in data space after the
219+
application of non-linear scales.
220+
221+
The image on the left demonstrates the new, correct behavior.
222+
The old behavior can be recreated using :func:`pcolormesh` as
223+
demonstrated on the right.
224+
225+
Non-linear scale example
226+
````````````````````````
227+
228+
.. plot::
229+
230+
import numpy as np
231+
import matplotlib.pyplot as plt
232+
233+
data = np.arange(30).reshape(5, 6)
234+
x = np.linspace(0, 6, 7)
235+
y = 10**np.linspace(0, 5, 6)
236+
X, Y = np.meshgrid(x, y)
237+
238+
fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(8, 4))
239+
240+
ax1.imshow(data, aspect="auto", extent=(0, 6, 1e0, 1e5), interpolation='nearest')
241+
ax1.set_yscale('log')
242+
ax1.set_title('Using ax.imshow')
243+
244+
ax2.pcolormesh(x, y, np.flipud(data))
245+
ax2.set_yscale('log')
246+
ax2.set_title('Using ax.pcolormesh')
247+
ax2.autoscale('tight')
248+
249+
plt.show()
250+
251+
252+
This can be understood by analogy to plotting a histogram with linearly spaced bins
253+
with a logarithmic x-axis. Equal sized bins will be displayed as wider for small
254+
*x* and narrower for large *x*.
255+
256+
215257

216258
Support for HiDPI (Retina) displays in the NbAgg and WebAgg backends
217259
--------------------------------------------------------------------

doc/users/whats_new/imshow_logscales.rst

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)