Skip to content

Commit 0195760

Browse files
committed
complex_plot: fix plot of undefined values
Undefined values would get some random color. Rreplace all undefined values by white. In numpy 1.24 this avoids a runtime warning (cast of nan to uint8).
1 parent 6aba936 commit 0195760

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/sage/plot/complex_plot.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False,
461461
rgb[i, j, 2] = b
462462

463463
sig_off()
464+
nan_indices = np.isnan(rgb).any(-1) # Mask for undefined points
465+
rgb[nan_indices] = 1 # Make nan_indices white
464466
return rgb
465467

466468

0 commit comments

Comments
 (0)