rwehrens / kohonen

Supervised and unsupervised self-organising maps
11 stars 9 forks source link

bug: `na.color` not working in plot.kohonen #18

Open ugroempi opened 1 year ago

ugroempi commented 1 year ago

Hi Ron, I just got bitten by a bug, because I wanted to use grey colors in the presence of na cells and therefore specified a separate na.color. It seems that the na.color argument does not have any effect, at least for types quality and count. The code below demonstrates the problem for type quality. It would be nice if that could be fixed; as the plot functions are quite nested, I am not sure about the source of the problem. It might have to do with plot.kohonen and plot.kohprop having an na.color argument (with default "gray"), while interim functions (such as plot.kohquality) do not always have the explicity argument but accommodate it in the ... only ? Best, Ulrike

demosom <- kohonen::som(as.matrix(swiss), grid=somgrid(7,6, topo="hexagonal")) ## default colors show NA cells in grey plot(demosom, shape="straight", type = "quality") ## deviating na color does not work plot(demosom, shape="straight", type = "quality", palette.name = gray.colors, na.color="red") plot(demosom, shape="straight", type = "quality", palette.name = cm.colors, na.color="red")