Total members 11621 |It is currently Wed Mar 29, 2017 7:55 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka

All times are UTC [ DST ]



  Good looking HeatMap example in R using ggplot2
Tue Feb 09, 2016 6:40 am 

In this example we show how to make a good looking heatmap using the ggplot2 R package. Following is the code example of using ggplot2 to plot the data as Heatmap.
Code:
projectName="XYZ"
RecallData <- read.csv("RankRecall_5_.csv",head=TRUE );
ApproachValue="BM25Fext"
msg=paste(projectName,ApproachValue,': Recall rate for each   training data',sep='')

#head(RecallData)



RecallData$month_name2 <- factor(RecallData$month_name,levels=c('1/2009' , '2/2009' ,'3/2009', '4/2009' ,'5/2009' ,'6/2009', '7/2009' ,'8/2009','9/2009','10/2009','11/2009','12/2009'));
# here comes the RColorBrewer package, now if you ask me why did you choose this palette colour
#I would say look at your battery charge indicator of your mobile for example your shaver,
# won't be red when gets low? and back to green when charged? This was the inspiration to choose this colour set.
ggplot(RecallData, aes(month_name2,distance)) +ylab("Training data by month")+xlab("Month/ Year") +
  geom_tile(aes(fill= (recall)),colour="black") + guides(colour = guide_legend(override.aes = list(size=0.3),ncol=1))+
  scale_fill_gradient2(na.value = "red", limits=c(0.35, 0.63), midpoint=median(0.51),guide="colorbar",low =  ("red"), mid = "yellow", high = "green", name="Recall \n Rate")+
  theme(legend.key.width=unit(0.2,"cm"),legend.margin=unit(-0.0,"cm"), legend.key.size=unit(0.4,"cm"),panel.background = element_blank(),panel.grid.major = element_blank(),panel.grid.minor = element_blank(),plot.title = element_text(size=4), plot.margin=unit(c(0,0,0,0),"mm"),axis.text.x=element_text(angle=-90,vjust= 0.0 ),axis.text = element_text(colour = "BLACK"),axis.text.x=element_text(colour="black"), text = element_text(size=10))







Attachments:
Rplot03.png
Rplot03.png [ 3.65 KiB | Viewed 3011 times ]
Author:
Mastermind
User avatar Posts: 2704
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Good looking HeatMap example in R using ggplot2
 here are 2 realy good books for sql     -  
 good books of jsp and jdbc     -  
 Good looking selection box with image per option     -  
 project in java.....plz suggest good ones........     -  
 need a good topic for project in java     -  
 How does one get good code for embeded video     -  
 Convert link and button to custom button with good style     -  

All times are UTC [ DST ]



Topic Tags

R Analysis






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team