forked from official-apps/SeismicHazardForecasting
		
	add 'g' as unit of colorbar for PGA and SA
This commit is contained in:
		@@ -545,6 +545,10 @@ verbose: {verbose}")
 | 
				
			|||||||
            gradient = np.vstack((gradient, gradient)).T
 | 
					            gradient = np.vstack((gradient, gradient)).T
 | 
				
			||||||
            gradient = np.tile(gradient, (1, width))
 | 
					            gradient = np.tile(gradient, (1, width))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            colorbar_title = products[j]
 | 
				
			||||||
 | 
					            if "PGA" in colorbar_title or "SA" in colorbar_title:
 | 
				
			||||||
 | 
					                colorbar_title = colorbar_title + "  (g)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            fig, ax = plt.subplots(figsize=((width + 40) / 100.0, (height + 20) / 100.0),
 | 
					            fig, ax = plt.subplots(figsize=((width + 40) / 100.0, (height + 20) / 100.0),
 | 
				
			||||||
                                   dpi=100)  # Increase fig size for labels
 | 
					                                   dpi=100)  # Increase fig size for labels
 | 
				
			||||||
            ax.imshow(gradient, aspect='auto', cmap=cmap.reversed(),
 | 
					            ax.imshow(gradient, aspect='auto', cmap=cmap.reversed(),
 | 
				
			||||||
@@ -554,7 +558,7 @@ verbose: {verbose}")
 | 
				
			|||||||
            tick_positions = np.linspace(vmin, vmax_hd, num_ticks)
 | 
					            tick_positions = np.linspace(vmin, vmax_hd, num_ticks)
 | 
				
			||||||
            ax.set_yticks(tick_positions)
 | 
					            ax.set_yticks(tick_positions)
 | 
				
			||||||
            ax.set_yticklabels([f"{tick:.2f}" for tick in tick_positions])  # format tick labels
 | 
					            ax.set_yticklabels([f"{tick:.2f}" for tick in tick_positions])  # format tick labels
 | 
				
			||||||
            ax.set_title(products[j], pad=15)
 | 
					            ax.set_title(colorbar_title, loc='right', pad=15) 
 | 
				
			||||||
            fig.subplots_adjust(left=0.25, right=0.75, bottom=0.05, top=0.95)  # Adjust Layout
 | 
					            fig.subplots_adjust(left=0.25, right=0.75, bottom=0.05, top=0.95)  # Adjust Layout
 | 
				
			||||||
            fig.savefig("colorbar_" + str(j) + ".svg", bbox_inches='tight')
 | 
					            fig.savefig("colorbar_" + str(j) + ".svg", bbox_inches='tight')
 | 
				
			||||||
            plt.close(fig)
 | 
					            plt.close(fig)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user