r - Add text and line to an `image()` in graphics -


i generated image in r two-dimensional data - x.

graphics::image(ifelse(drop(x)!=0, x, na)) 

i add text , line image.

i attempted text(10, 10, "testing") , segments(5, 10, 20, 25), neither text nor line displayed.

as @mrflick mentioned, image() rescales values 0-1 range.

see below example:

#dummy data set.seed(123) x <- matrix(runif(100),nrow=10)  #plot image(x)  #add text , line text(0.1,0.1,"text") segments(0.5,0.1,0.2,0.25) 

enter image description here


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -