# Graphics - nice variant of ImageSize (pixels per GraphicsUnitLength)

On my MMA, I apply the options

SetOptions[\$FrontEnd,
GraphicsBoxOptions -> {BaseStyle -> Magnification -> 72/120}]


Then I can assure the output Graphics has the width specified in the ImageSize option.

For example the code

Graphics[Circle[{0, 0}, 1], ImageSize -> 140] creates 140-pixel wide Graphics.

To create graphics with two or three overlapping circles of the same size, I can do the following.

Graphics[{Circle[{0, 0}, 1],
Circle[{1, 0}, 1]}, ImageSize -> 210]

Graphics[{Circle[{0, 0}, 1],
Circle[{1, 0}, 1],
Circle[{2, 0}, 1]
}, ImageSize -> 280] Notice that we had to calculated the value of ImageSize manually, to write the code.
The calculation was not that difficult, (140 * 1/2 *3 = 210, and 140 * 1/2 * 4 = 280) so that it was possible to do with mental arithmetic and elementary school level knowledge of geometry.

But the example above was in fact very easy. It will be difficult to calculate ImageSize in a Graphics where figures of various sizes and shapes mixed.

In this sense, it would be very nice if we had an (imaginary) option Pixels per Graphics Unit Length like the one below. See the following imaginary screenshot : Quetsion :
Is it possible to create Graphics of any size that I want, with the way explained above? I mean using Pixels per Graphics Unit Length concept.

• does this give what you need: Graphics[{Circle[{0, 0}, 1], Circle[{1, 0}, 1], Circle[{2, 0}, 1]}, ImageSize -> 1 -> 70]?
– kglr
Jun 5 at 23:15
• Wow! it works! Thank you very much! Simple and wonderful! You can write it as an answer If you want to be accepted as an answer. Jun 5 at 23:17

Use the syntax ImageSize -> 1 -> np to make 1 unit in user units to be rendered as np printer points:

g1 = Graphics[{AbsoluteThickness, Green, Circle[{0, 0}, 1]},
ImageSize -> 1 -> 70,

g2 = Graphics[{AbsoluteThickness, Red, Circle[{0, 0}, 1], Circle[{1, 0}, 1]},
ImageSize -> 1 -> 70,

g3 = Graphics[{AbsoluteThickness[1/2], Black, Circle[{0, 0}, 1],
Circle[{1, 0}, 1], Circle[{2, 0}, 1]},
ImageSize -> 1 -> 70,

Overlay[{g1, g2, g3}, Alignment -> {Left, Bottom}] • That syntax was new to me! Is it documented anywhere? (+1) Jun 6 at 0:58
• @MarcoB, afaik it is still not documented. It has been used a number of times on this site; but I can't locate the relevant Q/As.
– kglr
Jun 6 at 1:14
• – kglr
Jun 6 at 1:22
• Awesome, thank you! Jun 6 at 10:58
• Just for the record, np is in points. Jun 6 at 19:03