Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
186 views
in Technique[技术] by (71.8m points)

r - Modify coolBlueHotRed to be based on class attribute?

I am working on SOM and is generating heatmaps using the palette coolBlueHotRed.

The default coolBlueHotRed is this

coolBlueHotRed <- function(n, alpha = 1) {
  rainbow(n, end=4/6, alpha=alpha)[n:1]
}

I am using Shane Lynn R scripts to conduct this SOM/heatmap plotting and in it uses the plotHeatMap() function which takes in this palette coolBlueHotRed inside the script. An example of the heat map.

This heat map uses the coolBlueHotRed, which works perfectly fine. But, I will like to overlay this heat map with my class attribute to see how skew the class attribute is on the heat map.

Is there a way to modify this function such that the color can be based on my class attribute? I have a class attribute called car_type with 3 categorical data which are "1", "2" and "3".

question from:https://stackoverflow.com/questions/65866286/modify-coolbluehotred-to-be-based-on-class-attribute

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...