2
$\begingroup$

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.

$\endgroup$
1

1 Answer 1

2
$\begingroup$

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:

$\endgroup$
2
  • $\begingroup$ What is the unit of "Region"? How to display it in inch or cm? $\endgroup$ Commented Oct 8, 2017 at 6:13
  • $\begingroup$ @anhna It is pixels on the final rendered image. See the linked question about how they are connected to printer's points and inches. $\endgroup$ Commented Oct 8, 2017 at 13:30

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.