The size of image output

171 views
Skip to first unread message

Alexei Boulbitch

unread,
Dec 21, 2010, 12:23:01 AM12/21/10
to
Dear community,

Some journals require the figures for submitted papers to be of a
special size. For example, the Phys. Rev. group requires that the images
should be submitted in the eps format with the figure width of 8.5 cm.

Up to now I solved the problem by creating the image in Mathematica,
exporting it as an eps file followed by its resizing in Adobe
Illustrator, that has a simple tool for that.

I wonder, if there is a way to specify the size of the output image in
centimeters within Mathematica?

This question has already been discussed in 1999 (see units
in graphics). The method proposed there seems however, not to work with
the 8th version without modifications. Besides, it suffers from
uncertainty coming from the fact that "Mathematica adds a border around
the graphics and we cannot get the amount of margin that is used,
because it depends of the ticks labels, the plot label"

Are there any improvements in the later versions?

Best regards.

--
Alexei Boulbitch, Dr. habil.
Senior Scientist
Material Development

IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 CONTERN
Luxembourg

Tel: +352 2454 2566
Fax: +352 2454 3566
Mobile: +49 (0) 151 52 40 66 44

e-mail: alexei.b...@iee.lu

www.iee.lu

--

This e-mail may contain trade secrets or privileged, undisclosed or
otherwise confidential information. If you are not the intended
recipient and have received this e-mail in error, you are hereby
notified that any review, copying or distribution of it is strictly
prohibited. Please inform us immediately and destroy the original
transmittal from your system. Thank you for your co-operation.


JUN

unread,
Dec 22, 2010, 2:40:15 AM12/22/10
to
> e-mail: alexei.boulbi...@iee.lu

>
> www.iee.lu
>
> --
>
> This e-mail may contain trade secrets or privileged, undisclosed or
> otherwise confidential information. If you are not the intended
> recipient and have received this e-mail in error, you are hereby
> notified that any review, copying or distribution of it is strictly
> prohibited. Please inform us immediately and destroy the original
> transmittal from your system. Thank you for your co-operation.

Hi,
to get graphics exported with exactly determined dimensions, one
method with a lot of fine-tuning flexibility would be something along
these lines:

Graphics[{{FaceForm[], Rectangle[{0, 0}, {1, 1}]},
Inset[Plot[10^5 x^2, {x, -2, 2}, Frame -> True, Axes -> None],
ImageScaled[{0, 0}], ImageScaled[{0, 0}], ImageScaled[1]]},
ImageSize -> 40 72/25.4]

The invisible rectangle (FaceForm[ ]) contains your plot(s) as an
inset, and the image size applies to this rectangle. The exported PDF
then has the dimensions determined by the bounding rectangle. You just
have to arrange everything to fit into the rectangle the way you want
- that's what the ImageScaled[...] does in this example. For a
different aspect ratio, you'd have to change the Rectangle[...]
dimensions appropriately.

Jens

kj

unread,
Dec 23, 2010, 3:50:11 AM12/23/10
to
In <iepdjl$g3g$1...@smc.vnet.net> Alexei Boulbitch <alexei.b...@iee.lu> writes:

>Dear community,

>Some journals require the figures for submitted papers to be of a
>special size. For example, the Phys. Rev. group requires that the images
>should be submitted in the eps format with the figure width of 8.5 cm.


Here's *just a guess*: I'd try passing the options

ImageSize->{Round[(8.5/2.54)*72], Automatic}, ImageMargins->0

Also, ImagePadding may also be useful to you.

~kj

Jens Noeckel

unread,
Dec 23, 2010, 3:51:47 AM12/23/10
to
Thanks - my interpretation of this failure in version 7 is a little
different, though:
ImageScaled[1] seems to behave consistently with Scaled[1] (which is
officially valid) in versions 7 and 8. But neither Scaled nor
ImageScaled can be handled by Inset in version 7 when only a single
length argument is given. This only works in 8, and you're right in that
this change is not documented.

But at least it's an improvement because it brings more consistency
(ImageScaled coordinates are already being used the symbolic position
coordinates such as Center,...)

Jens

On Dec 22, 2010, at 3:55 AM, E. Martin-Serrano wrote:

>
>
> Hi,
>
> Your construct,


>
> Graphics[{{FaceForm[], Rectangle[{0, 0}, {1, 1}]},
> Inset[Plot[10^5 x^2, {x, -2, 2}, Frame -> True, Axes -> None],
> ImageScaled[{0, 0}], ImageScaled[{0, 0}], ImageScaled[1]]},
> ImageSize -> 40 72/25.4]
>

> in fact, works on V8 (TRIAL).
>
> But in does not in my V7.01; here it fails to produce the graphics and =
gives
> the message "Coordinate 1 should be a pair of numbers" (in
> *ImageScaled[1]*).
>
> However, if *ImageScaled[1]* is changed to *ImageScaled[{1,1}]* it =
does work
> in V7.01 too, apparently, rendering the same graphics.
>
> According to the documentation *ImageScaled[]* has not been modified =
in V8
>
> E. Martin-Serrano


>
>
> -----Original Message-----
> From: JUN [mailto:noe...@gmail.com]
> Sent: Wednesday, December 22, 2010 8:37 AM
> To: math...@smc.vnet.net
> Subject: Re: The size of image output
>
> On Dec 20, 9:23 pm, Alexei Boulbitch <alexei.boulbi...@iee.lu> wrote:

>> Dear community,
>>
>> Some journals require the figures for submitted papers to be of a

>> special size. For example, the Phys. Rev. group requires that the =
images
>> should be submitted in the eps format with the figure width of 8.5 =


cm.
>>
>> Up to now I solved the problem by creating the image in Mathematica,
>> exporting it as an eps file followed by its resizing in Adobe
>> Illustrator, that has a simple tool for that.
>>

>> I wonder, if there is a way to specify the size of the output image =


in
>> centimeters within Mathematica?
>>
>> This question has already been discussed in 1999 (see units

>> in graphics). The method proposed there seems however, not to work =


with
>> the 8th version without modifications. Besides, it suffers from

>> uncertainty coming from the fact that "Mathematica adds a border =


around
>> the graphics and we cannot get the amount of margin that is used,
>> because it depends of the ticks labels, the plot label"
>>
>> Are there any improvements in the later versions?
>>
>> Best regards.
>>
>> --
>> Alexei Boulbitch, Dr. habil.
>> Senior Scientist
>> Material Development
>>
>> IEE S.A.
>> ZAE Weiergewan
>> 11, rue Edmond Reuter
>> L-5326 CONTERN
>> Luxembourg
>>
>> Tel: +352 2454 2566
>> Fax: +352 2454 3566
>> Mobile: +49 (0) 151 52 40 66 44
>>

>> e-mail: alexei.boulbi...@iee.lu


>>
>> www.iee.lu
>>
>> --
>>
>> This e-mail may contain trade secrets or privileged, undisclosed or
>> otherwise confidential information. If you are not the intended
>> recipient and have received this e-mail in error, you are hereby
>> notified that any review, copying or distribution of it is strictly
>> prohibited. Please inform us immediately and destroy the original
>> transmittal from your system. Thank you for your co-operation.
>

E. Martin-Serrano

unread,
Dec 23, 2010, 3:53:27 AM12/23/10
to

Hi,

Your construct,

Graphics[{{FaceForm[], Rectangle[{0, 0}, {1, 1}]},
Inset[Plot[10^5 x^2, {x, -2, 2}, Frame -> True, Axes -> None],
ImageScaled[{0, 0}], ImageScaled[{0, 0}], ImageScaled[1]]},
ImageSize -> 40 72/25.4]

in fact, works on V8 (TRIAL).

But in does not in my V7.01; here it fails to produce the graphics and gives


the message "Coordinate 1 should be a pair of numbers" (in
*ImageScaled[1]*).

However, if *ImageScaled[1]* is changed to *ImageScaled[{1,1}]* it does work


in V7.01 too, apparently, rendering the same graphics.

According to the documentation *ImageScaled[]* has not been modified in V8

E. Martin-Serrano


-----Original Message-----
From: JUN [mailto:noe...@gmail.com]
Sent: Wednesday, December 22, 2010 8:37 AM
Subject: Re: The size of image output

On Dec 20, 9:23 pm, Alexei Boulbitch <alexei.boulbi...@iee.lu> wrote:

> e-mail: alexei.boulbi...@iee.lu


>
> www.iee.lu
>
> --
>
> This e-mail may contain trade secrets or privileged, undisclosed or
> otherwise confidential information. If you are not the intended
> recipient and have received this e-mail in error, you are hereby
> notified that any review, copying or distribution of it is strictly
> prohibited. Please inform us immediately and destroy the original
> transmittal from your system. Thank you for your co-operation.

Hi,

Reply all
Reply to author
Forward
0 new messages