0

I want to know the coordinates for the bounding box (top left, top right, bottom left, and bottom right coordinates) for the text "ABC" as shown in the screenshot:

example

My code is:

d <- data.frame(x = 0, y = 0, text = "ABCDEFGHIJKLM")
library(ggplot2)
ggplot(d, aes(x = x, y = y, label = text)) + geom_text()

In this example, the coordinate of the bottom of the text (this is what I am looking for) is: x = 0.0125, y = 0.002 .

I appreciate any solution/suggestion. Thanks.

zhanxw
  • 3,159
  • 3
  • 34
  • 32
  • 1
    In what units and relative to what? In cm, parental coordinates, inches, points, data units? Relative to the panel, the plot area? – teunbrand May 30 '20 at 08:22
  • In terms of the coordinates. I just revised the questions. If there is way to get cm/inches/points, that will be better. – zhanxw May 31 '20 at 07:54

0 Answers0