|
17 | 17 | ymin = y.min() |
18 | 18 | ymax = y.max() |
19 | 19 |
|
20 | | -plt.subplots_adjust(hspace=0.5) |
21 | | -plt.subplot(121) |
22 | | -plt.hexbin(x, y, cmap=plt.cm.YlOrRd_r) |
23 | | -plt.axis([xmin, xmax, ymin, ymax]) |
24 | | -plt.title("Hexagon binning") |
25 | | -cb = plt.colorbar() |
| 20 | +fig, axs = plt.subplots(ncols=2, sharey=True, figsize=(7, 4)) |
| 21 | +fig.subplots_adjust(hspace=0.5, left=0.07, right=0.93) |
| 22 | +ax = axs[0] |
| 23 | +hb = ax.hexbin(x, y, gridsize=50, cmap='inferno') |
| 24 | +ax.axis([xmin, xmax, ymin, ymax]) |
| 25 | +ax.set_title("Hexagon binning") |
| 26 | +cb = fig.colorbar(hb, ax=ax) |
26 | 27 | cb.set_label('counts') |
27 | 28 |
|
28 | | -plt.subplot(122) |
29 | | -plt.hexbin(x, y, bins='log', cmap=plt.cm.YlOrRd_r) |
30 | | -plt.axis([xmin, xmax, ymin, ymax]) |
31 | | -plt.title("With a log color scale") |
32 | | -cb = plt.colorbar() |
| 29 | +ax = axs[1] |
| 30 | +hb = ax.hexbin(x, y, gridsize=50, bins='log', cmap='inferno') |
| 31 | +ax.axis([xmin, xmax, ymin, ymax]) |
| 32 | +ax.set_title("With a log color scale") |
| 33 | +cb = fig.colorbar(hb, ax=ax) |
33 | 34 | cb.set_label('log10(N)') |
34 | 35 |
|
35 | 36 | plt.show() |
0 commit comments