MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Rotated text not appearing in a Plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118195] Re: Rotated text not appearing in a Plot
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Sat, 16 Apr 2011 07:33:39 -0400 (EDT)

You can work around the issue by flipping the Rotate and the Text, which also
removes the need to declare a point to rotate around, like so:

Plot[Log[x], {x, 1, 1000000},
 Epilog -> {Text["Appears normally", {500000, 12}],
   Text[Rotate["Appears normally", Pi/2], {500000, 12}],
   Text[Rotate["Appears normally", Pi/4], {500000, 12}]}]

[Long-winded meandering explanation follows...if you don't care, you can stop
here.]

The behavior you're seeing would have been much closer to correct if it were a
rectangle in the coordinates of the plot of equivalent size, and that seems to
be inappropriately influencing how Mathematica is treating the text (although
there are circumstances where one might want functionality like this...I think
the absolutely correct behavior here might be a bit elusive and require more
thought).  E.g., you can see a bit better what's happening here, in an example
where I've added a rectangle and scaled down the plot range somewhat:

Manipulate[
 Graphics[{Green,
   Rotate[Rectangle[{50, 12}, {55, 13}], \[Theta], {50, 12}], Black,
   Rotate[Text[Style["Some text", "Title"], {50, 12}], \[Theta], {50,
     12}]}, PlotRange -> {{0, 10^2}, {10, 14}},
  AspectRatio -> 1/GoldenRatio, AxesOrigin -> {50, 12},
  Axes -> True], {\[Theta], 0, Pi/2}]

Although it looks like the rectangle is being skewed as its rotated, it actually
remains perfectly rectangular in the coordinate system, which has a highly
stretched unit "square".

Pushing the Rotate inside of the Text[] causes the Rotate[] to happen completely
independent of the graphic's coordinate system, and preserves the way the text
would have naturally drawn.

Sincerely,

John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.


On Fri, 15 Apr 2011 03:54:22 -0400 (EDT), J. McKenzie Alexander wrote:
> Hello,
>
> When I evaluate the following, the first two text items from the Epilog
> appear but the third, for some reason, does not. I'm working on an i7
> iMac, running 10.6.7, Mathematica version 8.0.1, and I was wondering if
> this was a general bug or a version-specific bug.
>
> Plot[Log[x], {x, 1, 1000000},
> Epilog -> {
> Text["Appears normally", {500000, 12}],
> Rotate[Text["Appears normally", {500000, 12}], Pi/2, {500000, 12}],
> Rotate[Text["Doesn't appear", {500000, 12}], Pi/4, {500000, 12}]
> }
> ]
>
> Cheers,
>
> Jason
>
> --
> Dr J. McKenzie Alexander
> Department of Philosophy, Logic and Scientific Method
> London School of Economics and Political Science
> Houghton Street, London WC2A 2AE
>
>
> Please access the attached hyperlink for an important electronic
> communications disclaimer: http://lse.ac.uk/emailDisclaimer



  • Prev by Date: Re: Trignometric rules
  • Next by Date: Re: Another AppendTo replacement problem
  • Previous by thread: Re: Rotated text not appearing in a Plot
  • Next by thread: Outline navigator?