Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 82c4aab

Browse filesBrowse files
committed
DOC: explain logscales and imshow (closes #7661)
1 parent d181f63 commit 82c4aab
Copy full SHA for 82c4aab

File tree

Expand file treeCollapse file tree

1 file changed

+35
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+35
-0
lines changed
+35Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Non-linears scales on image plots
2+
---------------------------------
3+
4+
:func:`imshow` now draws data at the requested points in data space after the
5+
application of non-linear scales.
6+
7+
The image on the left demonstrates the new, correct behavior.
8+
The old behavior can be recreated using :func:`pcolormesh` as
9+
demonstrated on the right.
10+
11+
Example
12+
```````
13+
::
14+
15+
import numpy as np
16+
import matplotlib.pyplot as plt
17+
18+
data = np.arange(30).reshape(5, 6)
19+
x = np.linspace(0, 6, 7)
20+
y = 10**np.linspace(0, 5, 6)
21+
X, Y = np.meshgrid(x, y)
22+
23+
fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(8, 4))
24+
25+
ax1.imshow(data, aspect="auto", extent=(0, 5, 1e0, 1e5), interpolation='nearest')
26+
ax1.set_yscale('log')
27+
ax1.set_title('Using ax.imshow')
28+
29+
ax2.pcolormesh(x, y, np.flipud(data))
30+
ax2.set_yscale('log')
31+
ax2.set_title('Using ax.pcolormesh')
32+
ax2.autoscale('tight')
33+
34+
plt.show()
35+

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.