Re: Move frame labels closer to frame?
- To: mathgroup at smc.vnet.net
- Subject: [mg91308] Re: Move frame labels closer to frame?
- From: "David Park" <djmpark at comcast.net>
- Date: Thu, 14 Aug 2008 07:01:29 -0400 (EDT)
- References: <g7uo3p$5vf$1@smc.vnet.net>
Mark, I first did this with the Presentations package. The idea is to draw the sin curve without FrameLabel, leave the necessary amount of ImagePadding to accommodate the desired labels, set PlotRangeClipping -> False, then Inset the frame labels where we want using ImageScaled coordinates. Needs["Presentations`Master`"] Draw2D[ {Draw[Sin[x], {x, 0, 2 Pi}], Inset[Style["x", 14], ImageScaled[{.60, .045}]], Inset[Style["y axis", 14], ImageScaled[{.04, .54}], {Center, Center}, Automatic, {0, 1}]}, AspectRatio -> 1/GoldenRatio, Axes -> True, Frame -> True, PlotLabel -> "Plot label", PlotRangeClipping -> False, ImagePadding -> {{40, 5}, {30, 5}}] This takes some hand adjusting to get the ImageCoordinates correct. It is also possible to use actual plot coordinates, which is a little easier. But it is necessary to specify an explicit PlotRange so the Insets will fall outside the frame. The plot coordinates for the Insets will be outside the frame, but that's ok. Draw2D[ {Draw[Sin[x], {x, 0, 2 Pi}], Inset[Style["x", 14], {3.5, -1.3}], Inset[Style["y axis", 14], {-.6, 0}, {Center, Center}, Automatic, {0, 1}]}, AspectRatio -> 1/GoldenRatio, Axes -> True, Frame -> True, PlotRange -> {{0, 2 Pi}, {-1, 1}}, PlotRangePadding -> .1, PlotLabel -> "Plot Labels Where I Want!", PlotRangeClipping -> False, ImagePadding -> {{40, 5}, {30, 5}}] While the Presentations paradigm helps me think of this, because the frame labels are just two more things we want to draw, I have to be honest and show how this can also be done without Presentations. You just have to remember that you can use the Epilog option to add primitives to a set-piece plot. Plot[Sin[x], {x, 0, 2 Pi}, Axes -> True, Frame -> True, PlotRange -> {{0, 2 Pi}, {-1, 1}}, PlotRangePadding -> .1, PlotLabel -> "Plot Labels Where I Want!", PlotRangeClipping -> False, ImagePadding -> {{40, 5}, {30, 5}}, Epilog -> {Inset[Style["x", 14], {3.5, -1.3}], Inset[Style["y axis", 14], {-.6, 0}, {Center, Center}, Automatic, {0, 1}]}] -- David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ "Mark Fisher" <particlefilter at gmail.com> wrote in message news:g7uo3p$5vf$1 at smc.vnet.net... > Hi, > > It seems to me that the frame labels are too far from the frame. Is > there a way to control their placement and/or move them closer to the > frame? > > For example, > > Plot[Sin[x], {x, 0, 2 Pi}, Frame -> True, Axes -> True, > PlotLabel -> "Plot label", FrameLabel -> {{"y", None}, {"x", None}}, > FrameTicks -> Automatic] > > I just think the "x" and "y" labels are too far from the frame. This > becomes a real issue for me when I'm putting a bunch of plots in a > GraphicsGrid. > > Thanks. > > --Mark > > P.S. I'm using "6.0 for Microsoft Windows (32-bit) (May 21, 2008)" >