text

cedwards

·

color map

·

Plain Text

·

Total Size: 1.27 KB

·

·

Created: 4 years ago

·

Edited: 4 years ago

#decide on resolution for generated data x.res=100; y.res=100 #make generated data dat=expand.grid(x=seq(0,5, length=x.res), y=seq(0,8, length=y.res)) # calculate z values - here I make up fun trig interactions res=sin(dat$x+dat$y)*cos(1+dat$x/5) #matrix of results res.mat=matrix(res,nrow=x.res, ncol=y.res) require(viridis) require(fields) ## Here we can use the image.plot function of fields. It includes a legend image.plot(res.mat, col=viridis(200), xaxt="n", xlab="x", ylab="y", yaxt="n", axis.args=list(cex.axis=1.5), #fed to legend making itself - probably a sub-image? legend.args=list(text="Prob.", #fed to mtext padj=2, side=4, line=2, cex=2), cex.lab=2) axis(side=1, at=seq(0,1,length=5), labels=seq(0,5, length=5), cex.axis=2) axis(side=2, at=seq(0,1,length=5), labels=seq(0,8, length=5), cex.axis=2) ## Here we can use the base image option image(res.mat, col=viridis(200), xlab="x", ylab="y", xaxt = 'n', yaxt = 'n', cex.lab=1.7) axis(side=1, at=seq(0,1,length=5), labels=seq(0,5, length=5), cex.axis=1.4) axis(side=2, at=seq(0,1,length=5), labels=seq(0,8, length=5), cex.axis=1.4)

0 bits

1152 views

Are you sure you want to delete?