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

Skip to content

DOC: explain non-linear scales and imshow (closes #7661) #7800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 16, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
DOC: add non-linear scales blurb to main whats-new
  • Loading branch information
phobson committed Jan 16, 2017
commit a9530f6bb164a42e97ad2a87cd814d4cc9c4b695
42 changes: 42 additions & 0 deletions doc/users/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,48 @@ setting the private member ``_image_skew_coordinate`` has been
removed. Instead, images will obey the transform of the axes on which
they are drawn.

Non-linear scales on image plots
````````````````````````````````

:func:`imshow` now draws data at the requested points in data space after the
application of non-linear scales.

The image on the left demonstrates the new, correct behavior.
The old behavior can be recreated using :func:`pcolormesh` as
demonstrated on the right.

Non-linear scale example
````````````````````````

.. plot::

import numpy as np
import matplotlib.pyplot as plt

data = np.arange(30).reshape(5, 6)
x = np.linspace(0, 6, 7)
y = 10**np.linspace(0, 5, 6)
X, Y = np.meshgrid(x, y)

fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(8, 4))

ax1.imshow(data, aspect="auto", extent=(0, 6, 1e0, 1e5), interpolation='nearest')
ax1.set_yscale('log')
ax1.set_title('Using ax.imshow')

ax2.pcolormesh(x, y, np.flipud(data))
ax2.set_yscale('log')
ax2.set_title('Using ax.pcolormesh')
ax2.autoscale('tight')

plt.show()


This can be understood by analogy to plotting a histogram with linearly spaced bins
with a logarithmic x-axis. Equal sized bins will be displayed as wider for small
*x* and narrower for large *x*.



Support for HiDPI (Retina) displays in the NbAgg and WebAgg backends
--------------------------------------------------------------------
Expand Down
39 changes: 0 additions & 39 deletions doc/users/whats_new/imshow_logscales.rst

This file was deleted.