Re: Rotated text labels
- To: mathgroup at smc.vnet.net
- Subject: [mg106496] Re: Rotated text labels
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Thu, 14 Jan 2010 05:50:53 -0500 (EST)
- References: <hik92j$6ou$1@smc.vnet.net>
Am 13.01.2010 11:59, schrieb koringkriek:
> Hi,
> I want to add text labels on my plots and some of them need to be
> rotated. Usually I do it this way, eg.
>
> Show[
> Plot[Sin[x],{x,0,10}],
> Graphics[Rotate[Text[Style[" Text ",Medium,FontFamily->"Helvetica" ],
> {1,0.5}],Pi/4]]
> ]
>
> But as you can see, the label is distorted. This is not the case if
> the aspect ratio of the plot is set to automatic:
>
> Show[
> Plot[Sin[x],{x,0,10}, AspectRatio->Automatic],
> Graphics[Rotate[Text[Style[" Text ",Medium,FontFamily->"Helvetica" ],
> {1,0.5}],Pi/4]]
> ]
>
> But it is very rare that I can (want to) set the AspectRatio option to
> Automatic in my plots.
>
> Is there any way to get the rotated text labels that are not
> distorted?
I think the recommended way to do something like this would be using Inset:
Show[
Plot[Sin[x], {x, 0, 10}],
Graphics[Inset[
Style[" Text ", Medium, FontFamily -> "Helvetica"],
{1, 0.5}, {0, 0}, 1, {1/2, 1/Sqrt[2]}
]]
]
or
Plot[Sin[x], {x, 0, 10},
Epilog -> Inset[
Style[" Text ", Medium, FontFamily -> "Helvetica"],
{1, 0.5}, {0, 0}, 1, {1/2, 1/Sqrt[2]}
]
]
you might want to look up the various arguments of inset an their
meanings in the documentation...
hth,
albert