r - Plotting a SOM: how to change the colours? -


i have following dataset.

> ds           dataset_clustering.codice_domanda  fat_azi_mln importo_progetto num_addetti modelli formazione     22870                             22870 4.855849e-03       0.25386313 0.001403368       0          0     22893                             22893 3.606493e-04       0.40618102 0.115209837       0          0     16258                             16258 4.433197e-04       0.58254746 0.140670944       0          0     14684                             14684 6.189941e-04       0.35717439 0.304330393       0          0     12873                             12873 2.480110e-05       0.65121413 0.022654370       0          0     12933                             12933 2.603806e-02       0.02551876 0.017107725       0          1     12047                             12047 7.130316e-05       0.20094923 0.005012029       0          0     22880                             22880 1.963420e-05       0.16556291 0.015503876       0          0     11479                             11479 2.856260e-03       0.57615894 0.786688051       0          1     20836                             20836 3.089804e-04       0.20640177 0.004611067       0          0           investimento sostituzione campania costruzioni esito     22870            1            0        1           1     b     22893            1            0        1           1     r     16258            1            0        1           1     p     14684            1            0        1           1     p     12873            1            0        1           1     b     12933            0            0        1           1     b     12047            1            0        1           1     r     22880            1            0        1           1     b     11479            0            0        1           1     p     20836            1            0        1           1     b 

i want train som cluster dataset:

# train som grid_type<-'hexagonal' # 'rectangular' library(kohonen) num_rows <- 3 num_cols <- 3 r_length <- 100 # 100 1000 10000 100000 tpsom<-paste(grid_type," (",num_rows,"x",num_cols,")") set.seed(13) #------------------------------------------------------------------- somres <- som(as.matrix(ds[,2:length(colnames(ds))-1]),               grid=somgrid(ydim=num_rows,xdim=num_cols,grid_type),               rlen = r_length # default = 100 ) # create plot of som png("example.png")   par(mar=c(5.1,4.1,6.1,2.1))   plot(somres,        type = "counts",        #main=paste("analisi som - ","numero di input per cella","\n")        main=paste("analisi som\n","numero di input per cella","\n",                   "mappa: ",tpsom        )   ) dev.off() 

if obtain following figure: enter image description here

i don't how automatically set colours, because seems counterintuitive. i'd set 5 colours, starting white , becoming light red, normal red, dark red, darker red. otherwise, @ least invert colours of figure.

i cannot use parameter palette.name= etc etc. how can modify colours? if use ggplot loose property type = "counts" have plotting som.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -