1

I am having an issue with where tick marks are landing on an axis for a heatmap I am putting together. Below is the code to generate what I am getting currently as well as an image of what I am trying to achieve. I know that it is possible in ggplot2 (see: shifting tick positions in ggplot2) but I would like to do it in basic R packages. Thank you.

colfunc <- colorRampPalette(c("white", gray(.3, alpha = NULL)))
colorBarz=matrix(seq(0,7,len=14),nrow=1)
colorBarx=1
colorBary=seq(0,7,len=14)
cus_breaks=c(seq(0,7,len=15))
image(colorBarx,colorBary,colorBarz,col=colfunc(14),axes=FALSE,xlab="",ylab="",breaks=cus_breaks,cex.lab=2)
box(which="plot")
axis(2,at=seq(from = 0, to = 7, by = 1),las=2,cex.axis=2)

enter image description here

Adrian Reich
  • 165
  • 7

1 Answers1

1

Will this work?

colfunc <- colorRampPalette(c("white", gray(.3, alpha = NULL)))
colorBarz=matrix(seq(0,7,len=14),nrow=1)
colorBarx=1
colorBary=seq(0,7,len=15)
cus_breaks=c(seq(0,7,len=15)) 
image(colorBarx,colorBary,colorBarz,col=colfunc(14),axes=FALSE,xlab="",ylab="",breaks=cus_breaks,cex.lab=2,ylim=c(0,7))
box(which="plot")
axis(2,at=seq(from = 0, to = 7, by = 1),las=2,cex.axis=2)
platypus
  • 516
  • 3
  • 8