colorbar - R scalable color bar -
the code below small example 3d plotting. color bar @ right side, not scalable (so if maximize windows see larger pixels). solutions based on image.plot function , looking alternative produce scalable graphics.
require("rgl") require("fields") degreetoradian<-function(degree){ return (0.01745329252*degree) } turnpolartox<-function(amplitude,coordinate){ return (amplitude*cos(degreetoradian(coordinate))) } turnpolartoy<-function(amplitude,coordinate){ return (amplitude*sin(degreetoradian(coordinate))) } # inputs code test<-runif(359,min=-50,max=-20) # 359 elements correspond polar coordinates of 1 359 test2<-runif(359,min=-50,max=-20) # 359 elements correspond polar coordinates of 1 359 test3<-runif(359,min=-50,max=-20) # 359 elements correspond polar coordinates of 1 359 # add offset of 50 values. test <- test + 50 test2 <- test2 + 50 test3 <- test3 + 50 # start preparing data plotted in cartesian domain x1<-turnpolartox(test,1:359) y1<-turnpolartoy(test,1:359) z1<-rep(0,359) x2<-turnpolartox(test2,1:359) y2<-rep(0,359) z2<-turnpolartoy(test2,1:359) x3<-rep(0,359) y3<-turnpolartox(test3,1:359) z3<-turnpolartoy(test3,1:359) # time plotting min<-min(test,test2,test3) max<-max(test,test2,test3) bgplot3d( suppresswarnings ( image.plot( legend.only=true, legend.args=list(text='dbm/100khz'), zlim=c(min,max)-50,col=plotrix::color.scale(seq(min-50,max-50,length.out=21),c(0,1,1),c(0,1,0),0,xrange=c(min,max)-50)) ) # zlim colorbar numbers )
any ideas or suggestions more welcome.
thanks lot. regards alex
Comments
Post a Comment