Hi all,
I am trying to add a color legend to my plot. As an example I am giving you a
bit of code that you can run.
I am sharing for everyone a small data snipset that you can load
https://www.dropbox.com/s/fh8jhwujgunmtrb/DataToPlotAsImage.Rdata
load("DataToPlotAsImage.Rdata")
require(plotrix)
browser()
test<-data
# this transforms the values of "test" into red->yellow
color2D.matplot(test,axes="F",xlab="",ylab="",main="color.scale",
extremes=c("#FF0000","#FFFF00"),show.legend=FALSE)
axis(1,at=seq(1,ncol(test),length.out=10),labels=seq(201,300,length.out=10))
color.legend(104,30,112,70,seq(-110,-30,length=11),
align="rb",rect.col=color.scale(1:30,1,c(0,1),0),gradient="y")
as you can see I have problems where the legend appears. My par("usr"
returned me
par("usr")
# [1] 0 351 0 200
but I am not sure how to read that to place the legend at a useful place.
second I am not sure why the image is so full with black rows..
What I want is to have the legend visible
and later on customize the x axis to write custom string of different
size... First I need though to fix the more severe problems as I have
described
RegardsAlex
[[alternative HTML version deleted]]