5
$\begingroup$

I'm trying to use GraphicsColumn to plot two curves with very different ranges. for example,

GraphicsColumn[{Plot[Sin[x], {x, 0, 10}, PlotRange -> All, 
   AspectRatio -> 0.3, Frame -> True, Axes -> False, 
   ImageMargins -> 20], 
  Plot[Cos[x], {x, 0, 10}, PlotRange -> All, AspectRatio -> 0.3, 
   Frame -> True, Axes -> False, ImageMargins -> 20]}, 
 Epilog -> {Text["Frequency", {Center, Bottom}], 
   Rotate[Text["Power", {0.5, Center}], 90 Degree]}]

But the x label is not displayed properly, i.e., it is cut by the edge of the graph.

enter image description here

How to improve it?

$\endgroup$
1

2 Answers 2

10
$\begingroup$

PlotRangePadding option can give you more space around your graphics objects.

GraphicsColumn[{Plot[Sin[x], {x, 0, 10}, PlotRange -> All, 
   AspectRatio -> 0.3, Frame -> True, Axes -> False, 
   ImageMargins -> 20], 
  Plot[Cos[x], {x, 0, 100}, PlotRange -> All, AspectRatio -> 0.3, 
   Frame -> True, Axes -> False, ImageMargins -> 20]}, Epilog -> 
  Style[{Text["Frequency", Scaled@{.5, .02}], 
    Rotate[Text["Power", Scaled@{.03, .5}], 90 Degree]}, 14, 
   FontFamily -> "Helvetica"], PlotRangePadding -> {0, 70}, 
 ImageSize -> 500]

enter image description here

$\endgroup$
4
  • $\begingroup$ Thank you. You've known so much about plot! $\endgroup$
    – yulinlinyu
    Jun 26, 2012 at 4:08
  • $\begingroup$ @Mr.Wizard Just checked. Image corresponds to the code. M.8.0.4, win7. $\endgroup$ Jun 26, 2012 at 5:57
  • $\begingroup$ @Mr.Wizard Maybe something changed for absolute coordinate specs from v7 to v8. I changed code to scaled coordinates. Could you check if this helps? $\endgroup$ Jun 26, 2012 at 6:07
  • $\begingroup$ Confirmed to work. +1 $\endgroup$
    – Mr.Wizard
    Jun 26, 2012 at 6:19
6
$\begingroup$

An alternative using Labeled:

Labeled[
 GraphicsColumn[{
   Plot[Sin[x], {x, 0, 10}, PlotRange -> All, AspectRatio -> 0.3,
    Frame -> True, Axes -> False, ImageMargins -> 0], 
   Plot[Cos[x], {x, 0, 100}, PlotRange -> All, AspectRatio -> 0.3, 
    Frame -> True, Axes -> False, ImageMargins -> 0]}, 
   Alignment -> Left], 
 {"Frequency", "Power"}, {Bottom, Left}, 
 RotateLabel -> True, 
 LabelStyle -> Directive[Bold, FontFamily -> "Helvetica"], 
 FrameMargins -> 0, ImageMargins -> 10]

enter image description here

$\endgroup$
1
  • $\begingroup$ I prefer this one! $\endgroup$
    – yulinlinyu
    Jun 26, 2012 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.