Hi , I would like to use ggplot2 to plot a matrix as an image. You can copy paste the following
Data<-matrix(data=rnorm(900,80,20),nrow=30,ncol=30) lengthOut<-5 Lengths<- 15 library(reshape2) library(ggplot2) tdm <- melt(Data) ggplot(tdm, aes(x = Var2, y = Var1, fill = factor(value)),levels=seq(0,1,by=0.1)) + labs(x = "MHz", y = "Threshold", fill = "Duty Cycle") + geom_raster(alpha=1) + scale_fill_discrete(h.start=1,breaks=c(20,30,40,50,60,70,80,90),labels=c(20,30,40,50,60,70,80,90),fill="red") + scale_x_continuous(expand = c(0, 0)) + scale_y_continuous(expand = c(0, 0)) # End of code part What I wanted to do is to print the values below 20, with an x color between 20-30, with a y clor between 30-40, with a z color and so on.... I would not care now for the color palette. Any would do. Could you please help me with that? Regards A [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.