Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1755 > unrolled thread

ImageMargins and Frame Labels

Started byGabriel Landi <gtlandi@gmail.com>
First post2011-04-17 11:55 +0000
Last post2011-04-17 23:15 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  ImageMargins and Frame Labels Gabriel Landi <gtlandi@gmail.com> - 2011-04-17 11:55 +0000
    Re: ImageMargins and Frame Labels "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com> - 2011-04-17 23:15 +0000

#1755 — ImageMargins and Frame Labels

FromGabriel Landi <gtlandi@gmail.com>
Date2011-04-17 11:55 +0000
SubjectImageMargins and Frame Labels
Message-ID<ioeker$n3t$1@smc.vnet.net>
Fellow Mathematica users,

I periodically encounter the same problem when producing Mathematica
graphics that will later be used in publications:
When the graph has tick marks or labels, the center of the framed plot
becomes asymmetric, which is terrible when you wish to publish your plot.
The problem is worse in the horizontal direction.

Here is a simple example:

graph = Plot[Sin[x], {x,0,Pi}, Frame->True, FrameLabel->{x,Sin[x]}]

I have so far found two ways of solving this:

1) The brute force way: Include ImageMargins->{{0,x},{0,y}} and keep
adjusting x and y until you are satisfied.

2) Use a panel:

Panel[graph, Background ->White, Alignment->Center].

You can then include a ImagePadding command in graph. But this is confusing
and I personally have never adapted well to it.
You also encounter problems with ImageSize and AspectRatio. Say, for
instance, you use ImageSize->500 in graph. Since the AspectRatio of graph is
by default GoldenRatio, this command adapts well to it. But the panel, on
the other hand, has AspectRatio -> 1 which means that you will need to
Specify some sort of command like ImageSize->{GoldenRatio 500, 500} in the
panel as well.

Anyway, does someone know a smart way to produce symmetric graphics without
having all this trouble?

Thanks in advance,

Gabriel T. Landi

[toc] | [next] | [standalone]


#1771

From"Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com>
Date2011-04-17 23:15 +0000
Message-ID<iofsba$s43$1@smc.vnet.net>
In reply to#1755
What's wrong with adding ImagePadding to the plot?

graph = Plot[Sin[x], {x,0,Pi}, Frame->True, FrameLabel->{x,Sin[x]},
ImagePadding -> 40]

This adds 40 pts to all sides, so the center of the plot stays at the
center of the graph. Any value is good as long as the labels fit in.
The amount you'll need will depend on font size and font family, but
for any given choice it's not difficult to find the perfect value.

Cheers -- Sjoerd

More Mathematica questions answered at: http://stackoverflow.com/questions/tagged/mathematica




On Apr 17, 1:55 pm, Gabriel Landi <gtla...@gmail.com> wrote:
> Fellow Mathematica users,
>
> I periodically encounter the same problem when producing Mathematica
> graphics that will later be used in publications:
> When the graph has tick marks or labels, the center of the framed plot
> becomes asymmetric, which is terrible when you wish to publish your plot.
> The problem is worse in the horizontal direction.
>
> Here is a simple example:
>
> graph = Plot[Sin[x], {x,0,Pi}, Frame->True, FrameLabel->{x,Sin[x]}]
>
> I have so far found two ways of solving this:
>
> 1) The brute force way: Include ImageMargins->{{0,x},{0,y}} and keep
> adjusting x and y until you are satisfied.
>
> 2) Use a panel:
>
> Panel[graph, Background ->White, Alignment->Center].
>
> You can then include a ImagePadding command in graph. But this is confusing
> and I personally have never adapted well to it.
> You also encounter problems with ImageSize and AspectRatio. Say, for
> instance, you use ImageSize->500 in graph. Since the AspectRatio of graph is
> by default GoldenRatio, this command adapts well to it. But the panel, on
> the other hand, has AspectRatio -> 1 which means that you will need to
> Specify some sort of command like ImageSize->{GoldenRatio 500, 500} in the
> panel as well.
>
> Anyway, does someone know a smart way to produce symmetric graphics without
> having all this trouble?
>
> Thanks in advance,
>
> Gabriel T. Landi

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web