2

Is there any way to measure a distance from a graph in centimeter or inch exactly in Mathematica? I tried to use toolbar Ruler but I can only use it to measure width horizontally and can't switch it vertically to measure height. Also, I don't think we can use it to measure exactly the anything.

To be more specific, I am trying to measure the coordinates returns by function Offset[{10, 20}, {0, 0}] as bellow and check whether the offset distance is {10/72,20/72) inch or not.

Graphics[Rectangle[Offset[{10, 20}, {0, 0}], Offset[{-10, -20}, {1, 1}]], Frame -> True]

So how can I measure these distances? The purpose of the measurement is to check if I understand the offset coordinate correctly.

emnha
  • 2,101
  • 13
  • 26

1 Answers1

2

Here is one way:

g = Graphics[
  Annotation[
   Rectangle[Offset[{10, 20}, {0, 0}], Offset[{-10, -20}, {1, 1}]], 
   "Rectangle", "Region"], ImageSize -> 100, PlotRangePadding -> None];

Rasterize[g, "Regions"]
{{"Rectangle", "Region"} -> {{10., 20.}, {89., 79.}}}

Recommended reading:

Alexey Popkov
  • 61,809
  • 7
  • 149
  • 368