Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Axis Labels on Plots Using a Frame

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127247] Re: Axis Labels on Plots Using a Frame
  • From: "djmpark" <djmpark at comcast.net>
  • Date: Wed, 11 Jul 2012 02:19:23 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <7842051.135469.1341895329363.JavaMail.root@m06>

This problem also applies when Mathematica puts the frame labels too far
away from the frame. This is especially apparent on the x axis. 

In any case, the solution is to make your own labels by drawing outside the
frame. To do this one uses two options: ImagePadding creates space to draw
and PlotRangeClipping -> False prevents Mathematica from clipping things you
draw that are outside the frame.

The following is an example using ListPlot.

ListPlot[Table[{Sin[n], Sin[2 n]}, {n, 50}],
 PlotStyle -> AbsolutePointSize[5],
 Epilog -> {Text[Style["x", 16], {1.2, -1.2}],
   Text[Style["y", 16], {-1.15, 1.25}]},
 Frame -> True,
 PlotRange -> {{-1.1, 1.1}, {-1.1, 1.1}},
 PlotRangeClipping -> False,
 ImagePadding -> {{30, 40}, {30, 35}}] 

It's a little more intuitive with the Presentations Application because
there you just draw one thing after another.

<< Presentations` 

Draw2D[
 {AbsolutePointSize[5],
  ListDraw[Table[{Sin[n], Sin[2 n]}, {n, 50}]],
  Text[Style["x", 16], {1.2, -1.2}],
  Text[Style["y", 16], {-1.15, 1.25}]},
 AspectRatio -> 0.6,
 Frame -> True,
 PlotRange -> 1.1,
 PlotRangeClipping -> False,
 ImagePadding -> {{30, 40}, {30, 35}}] 


David Park
djmpark at comcast.net 
http://home.comcast.net/~djmpark/index.html 





From: Gregory Lypny [mailto:gregory.lypny at videotron.ca] 


Hello everyone,

I added a frame as an option to a list plot, and my x and y axis labels
disappeared.  So I used FrameLabel, but the labels were placed centred below
the x axis and centred beside the y axis.  Is there any way I can get them
to appear at the end of the x axis, that is, the bottom right of the frame,
and the top left for the y?

Regards,

Gregory




  • Prev by Date: Re: what would cause a symbol not to clear using Clear[name] or Remove[name]?
  • Next by Date: Re: polarplot with arrow bearing tickmarks
  • Previous by thread: Axis Labels on Plots Using a Frame
  • Next by thread: strange booleanconvert behavior?