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 25158c2

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

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

0 commit comments

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