@brief density map contour and heat map
(density_map, name)
| 121 | |
| 122 | |
| 123 | def plot(density_map, name): |
| 124 | """ |
| 125 | @brief density map contour and heat map |
| 126 | """ |
| 127 | print(np.amax(density_map)) |
| 128 | print(np.mean(density_map)) |
| 129 | fig = plt.figure(figsize=(4, 3)) |
| 130 | ax = fig.gca(projection='3d') |
| 131 | |
| 132 | x = np.arange(density_map.shape[0]) |
| 133 | y = np.arange(density_map.shape[1]) |
| 134 | |
| 135 | x, y = np.meshgrid(x, y) |
| 136 | ax.plot_surface(x, y, density_map, alpha=0.8) |
| 137 | |
| 138 | ax.set_xlabel('x') |
| 139 | ax.set_ylabel('y') |
| 140 | ax.set_zlabel('density') |
| 141 | |
| 142 | #plt.tight_layout() |
| 143 | plt.savefig(name + ".3d.png") |
| 144 | |
| 145 | plt.clf() |
| 146 | |
| 147 | fig, ax = plt.subplots() |
| 148 | |
| 149 | ax.pcolor(density_map) |
| 150 | |
| 151 | # Loop over data dimensions and create text annotations. |
| 152 | #for i in range(density_map.shape[0]): |
| 153 | # for j in range(density_map.shape[1]): |
| 154 | # text = ax.text(j, i, density_map[i, j], |
| 155 | # ha="center", va="center", color="w") |
| 156 | fig.tight_layout() |
| 157 | plt.savefig(name + ".2d.png") |