How do I find the average x in ANY plot in R using grconvertX?
I am wondering what ANY plot is drawn using BASE R (i.e. without any layout()
or mfcol()
or mfrow()
) (see example below), how can one find the "X" coordinate of a point that would always be exactly in the middle of this plot (suppose that "Y" for a point is arbitrary)?
I think it's grconvertX
intended for this, but I'm not sure how it works (I appreciate a good explanation in grconvertX
) as it has a lot of customization (see below).
plot(1, t = "n", log = "x")
mean( grconvertX(0:1, "user") )
mean( grconvertX(0:1, "nic") )
mean( grconvertX(0:1, "nfc") )
mean( grconvertX(0:1, "ndc") )
mean( grconvertX(0:1, "npc") )
mean( grconvertX(0:1, "device") )
+3
source to share