@@ -62,46 +62,49 @@ def draw_delaunay_pixels(
6262 If `True`, the colorbar is plotted using a log10 scale.
6363 """
6464
65- if pixel_values is None :
66- raise ValueError (
67- "pixel_values input to DelaunayPlotter are None and thus cannot be plotted."
68- )
69-
7065 if ax is None :
7166 ax = plt .gca ()
7267
7368 source_pixelization_grid = mapper .mapper_grids .source_plane_mesh_grid
7469
7570 simplices = mapper .delaunay .simplices
7671
77- facecolors = facecolors_from (values = pixel_values , simplices = simplices )
72+ if pixel_values is not None :
73+ facecolors = facecolors_from (values = pixel_values , simplices = simplices )
74+
75+ norm = cmap .norm_from (array = pixel_values , use_log10 = use_log10 )
76+
77+ if use_log10 and pixel_values is not None :
78+ pixel_values [pixel_values < 1e-4 ] = 1e-4
79+ pixel_values = np .log10 (pixel_values )
7880
79- norm = cmap .norm_from (array = pixel_values , use_log10 = use_log10 )
81+ vmin = cmap .vmin_from (array = pixel_values , use_log10 = use_log10 )
82+ vmax = cmap .vmax_from (array = pixel_values , use_log10 = use_log10 )
8083
81- if use_log10 :
82- pixel_values [pixel_values < 1e-4 ] = 1e-4
83- pixel_values = np .log10 (pixel_values )
84+ color_values = np .where (pixel_values > vmax , vmax , pixel_values )
85+ color_values = np .where (pixel_values < vmin , vmin , color_values )
8486
85- vmin = cmap .vmin_from (array = pixel_values , use_log10 = use_log10 )
86- vmax = cmap .vmax_from (array = pixel_values , use_log10 = use_log10 )
87+ cmap = plt .get_cmap (cmap .cmap )
8788
88- color_values = np .where (pixel_values > vmax , vmax , pixel_values )
89- color_values = np .where (pixel_values < vmin , vmin , color_values )
89+ if colorbar is not None :
90+ cb = colorbar .set_with_color_values (
91+ units = units ,
92+ norm = norm ,
93+ cmap = cmap ,
94+ color_values = color_values ,
95+ ax = ax ,
96+ use_log10 = use_log10 ,
97+ )
9098
91- cmap = plt .get_cmap (cmap .cmap )
99+ if cb is not None and colorbar_tickparams is not None :
100+ colorbar_tickparams .set (cb = cb )
92101
93- if colorbar is not None :
94- cb = colorbar .set_with_color_values (
95- units = units ,
96- norm = norm ,
97- cmap = cmap ,
98- color_values = color_values ,
99- ax = ax ,
100- use_log10 = use_log10 ,
101- )
102+ else :
102103
103- if cb is not None and colorbar_tickparams is not None :
104- colorbar_tickparams .set (cb = cb )
104+ cmap = plt .get_cmap (cmap .cmap )
105+ facecolors = np .zeros (shape = simplices .shape [0 ])
106+ vmin = 0.0
107+ vmax = 0.0
105108
106109 ax .tripcolor (
107110 source_pixelization_grid [:, 1 ],
0 commit comments