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

Skip to content

Commit bf47ef2

Browse files
committed
replace plt.hist2d with np.histogram2d and plt.pcolormesh
1 parent 401e4fe commit bf47ef2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

examples/statistics/time_series_histogram.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@
6464
# that has a periodicity of about ~6 and oscillates between +1/-1.
6565
cmap = copy(plt.cm.Blues)
6666
cmap.set_bad(cmap(0))
67-
axes[1].hist2d(*xy.T, bins=[200, 200], cmap=cmap, norm=LogNorm())
67+
h, xedges, yedges = np.histogram2d(*xy.T, bins=[200, 200])
68+
axes[1].pcolormesh(xedges, yedges, h.T, cmap=cmap, norm=LogNorm())
6869
axes[1].set_title(
6970
r"Alternative time series vis. using `plt.hist2d` and log color scale")
7071

7172
# It is even visible on a linear color scale
72-
axes[2].hist2d(*xy.T, bins=[200, 200], cmap=cmap)
73+
h, xedges, yedges = np.histogram2d(*xy.T, bins=[200, 200])
74+
axes[2].pcolormesh(xedges, yedges, h.T, cmap=cmap)
7375
axes[2].set_title(
7476
r"Alternative time series vis. using `plt.hist2d` and linear color scale")
7577
toc = time.time()

0 commit comments

Comments
 (0)