I have a dataframe "df" like following (example):
ID type group
A3EP 1 M
A3MA 2 M
A459 3 M
A3I1 1 N
A9D2 2 N
A3M9 3 N
A7XP 1 O
A4ZP 2 O
A4ZP 3 O
Original table is with 1000 ID's. For this I have used heatmap.3 function. Ofcourse this is not a heatmap but I tried getting the color plot using this function.
clab=cbind(df$type,df$group)
colnames(clab)=c("Type","Group")
heatmap.3(clab, margins=c(6,17), Rowv=FALSE, Colv=FALSE)
And this gave me a plot like following:
![enter image description here][1]
The upper part in the image is group "M", "N", "O". And below that it shows "type". But I see both "groups" and "types" in the same colors. What I need to do to get a different colors for "groups" and "types". Along with that I want to see "ID" names below "types".
Can anyone help me how to do this? Thank you
It'd be better to make a plot for each and put them side by side.
Yes, I can do that. Even then the colors would be same I guess. Instead if I assign different colors for group and type it would work right. And I don't have any idea how to do that and also I need the ID names below types.
I mean plot group and type separately, then assigning different colors is trivial. If they get different colors, they below in different subplots.
No, it didn't work. it throws an error.
I also tried with "ggplots2" with some setup data. But it didn't work for my original data.
What did you try? Can you post some code?
I had posted it below. Please check it
I just want to know how to assign different colors for the columns "group" and "type" and also want to see the ID names below the type.
I don't understand what you are trying to plot. Your example data frame contains three columns. What do you want on the X axis? On Y? Which column do you want to map as color?
I want to check the "type" comes under which "group". And also need ID names below type.
If you see the plot in the upper part RED color is group "M" Saffron is group "N" and white color is "O".
Down part are the "types". Red -1, saffron - 2, white - 3.
What I need is different colors for Groups and types. Also need the ID names below the types.
but if you have 1000s of IDs as you say, then the plot will become very confused. You will not be able to read the ID names, unless you have a very long plot.
Yes, Ofcourse I will be having a long plot. small or long is not the problem now. I just gave a random number of ID's. I totally have 350 ID's. Any idea how to do this?
Then you did it wrong.
No, that is different data.
This plot looks different from what I want for my original data. So, if you can help me how to set up this to my data please let me know.
Those are the steps for you to follow. If you need further help I would suggest asking in an R forum, since this isn't really in the scope of this site.
As you said I tried doing first plot and then second plot. In the first plot group "M" is with red colour and types 1 is red and 2,3 are yellow. The color key need to be changed. that is what I just want. Anyways thanks for the reply. Will ask in R forum.