This isn't so much an answer as to how to fix this (one workaround is Column[{plot1,plot2,plot3}]
, instead of GraphicsColumn
, but it has its drawbacks), but more of an explanation of what's happening.
First I generate some fake data and create a plot similar to yours:
data = SortBy[RandomReal[10, {10, 2}], First];
plot = ListPlot[data, Frame -> True, Joined -> True, PlotRange -> All,
LabelStyle -> {FontSize -> 15}, PlotStyle -> Black,
AspectRatio -> .3, ImageSize -> 900,
FrameLabel -> {"", "", Style["Plot", 15]}]
ImageDimensions[plot]
(* {900, 324} *)
Then do
GraphicsColumn[{plot,plot,plot}]
(* Get result with narrower plots, than desired. Also their height is smaller *)
Now let's take a closer look at the structure of the output.
InputForm[%];
TableForm @@ %
Inset[(*Graphics of plot*), {472.5, -145.125}, ImageScaled[{0.5, 0.5}], {900, 270.}]...
Let's check out the documentation of Inset
. It places the point ImageScaled[{.5,.5}]
(the center) of plot
at the point {472.5,-145.125}
in the enclosing graphics object... and resizes plot
to {900, 270}
. I can't say, why exactly this is done like that, but it explains, why your plots in the column become narrower.
You have specified an AspectRatio
of 0.3
, which means that the height-to-width of the framed part of your plot is 0.3.
When sticking this into the Inset
Mathematica lazily just says "let the height-to-width of the entire inset (including margins for ticks and labels) be 0.3" which is not the same thing. While the correct width of your image is maintained at 900, the height of the plot with margins is now constrained to 270 instead of 324. To maintain the aspect ratio of the plotrange at 0.3 it has to also become narrower. I guess, there's a number of ways to work around this, e.g. pass ImageSize->{900,324}, AspectRatio->Full
to your plots. My preferred way (by no means the best) is detailed here
EDIT
Here's a test with DateListPlot
:
xdata = DateList /@ Range[3.6*10*^9, 3.63*10*^9, .3*10*^7];
ydata = RandomReal[10, 11];
data = Transpose[{xdata, ydata}];
plot = DateListPlot[data, Frame -> True, Joined -> True,
PlotRange -> All, LabelStyle -> {FontSize -> 15},
PlotStyle -> Black, AspectRatio -> Full, ImageSize -> {900, 324},
FrameLabel -> {"", "", Style["Plot", 15]}];
GraphicsColumn[{plot, plot, plot}]
This returns the desired result on my machine (MMA v10.0.1.0, Win7x64 Enterprise)
EDIT2 Here's how I prefer to arrange graphics into grids and such.
undistortedGraphicsColumn[list_] :=
Module[{sizes = ImageDimensions /@ list, width},
width = Max@sizes[[All, 1]];
sizes = sizes[[All, 2]];
Graphics[Table[
Inset[list[[i]], {0, -Plus @@ sizes[[;; i]]},
ImageScaled[{0, 0}]], {i, Length[list]}],
ImageSize -> {width, Plus @@ sizes}, ImagePadding -> None,
PlotRange -> {{0, width}, {-Plus @@ sizes, 0}},
AspectRatio -> Plus @@ sizes/width, PlotRangePadding -> None]]
Now this line will return the plots in a column exactly how they look individually:
undistortedGraphicsColumn[{plot,plot,plot}]
If you go with your original code now:
plot =
DateListPlot[data, {{2000, 12, 31}, {2007, 12, 31}},
Frame -> True, Joined -> True, PlotRange -> All,
LabelStyle -> {FontSize -> 15}, PlotStyle -> Black, ImageSize -> 900,
AspectRatio -> 0.3, FrameLabel -> {"", "", Style["Plot", 15]}]
And stick it into my function, you don't get the problem with enormous ticks and the column shows the plots as they are originally defined.
GraphicsColumn
(-Row, -Grid, etc). These functions generate an object with headGraphics
and useInset
to place your plots inside. The problem is, they set the size of the individual plots to{imagewidth, aspectratio*imagewidth}
whereas for an individual plot it is the plot range that maintains your aspect ratio setting. In your case your plot is900*324
, but in the column it's900*270
so to maintainAspectRatio->0.3
it has to be narrowed. $\endgroup$