10
$\begingroup$

I'm trying to come up with a MWE:

anyData = Range[10];
Column@Table[ListLinePlot[n*anyData, Frame -> True], {n, {-1, 1}}]

The lateral size of the plotframe varies, depended on the y-frame-label/ticks. In the example below this is due to the use of negative values, but in general any difference in ticksnumbers and labeling could cause this.

My question:

Is there a way to get both of the plotframes equal in size and aligned? Unfortunately, I'm aware that this might end in the consequence of unequal overall imagesizes. But maybe one could add some blank regions by Padding or so... I hope for some possible solutions.

Thanks for your try!!

enter image description here

$\endgroup$
8
  • $\begingroup$ You tried increasing ImagePadding? $\endgroup$
    – BlacKow
    Apr 14, 2016 at 17:08
  • $\begingroup$ Yes I tried. It might work for some plots, but one has to adjust that manually, right? Not really, what I was hoping for. How can I control, that both framesizes are exactly equal? $\endgroup$
    – Kay
    Apr 14, 2016 at 17:13
  • $\begingroup$ Setting ImageSize and ImagePadding identical for two plots doesn't make the plot content aligned and identical size? $\endgroup$
    – BlacKow
    Apr 14, 2016 at 17:16
  • $\begingroup$ @BlacKow The issue is that the tick labels occupy a variable amount of space, depending on their values. Of course, with a bit of work that size can be determined and accounted for. $\endgroup$
    – bbgodfrey
    Apr 14, 2016 at 17:19
  • 2
    $\begingroup$ Many related: 1337, 4059, 1025, 66350, etc. $\endgroup$ Apr 14, 2016 at 17:53

1 Answer 1

5
$\begingroup$

Thanks to BlacKow I just found out that:

"ImagePadding is defined within ImageSize"

and

"ImageMargins is defined outside of ImageSize"

anyData = Range[10];
pad = 40;
l1 = ListLinePlot[-1*anyData, Frame -> True, 
       ImagePadding -> {{pad, 1}, {1, 1}}, ImageSize -> 300];
l2 = ListLinePlot[10000*anyData, Frame -> True, 
       ImagePadding -> {{pad, 1}, {1, 1}}, ImageSize -> 300];
Column@{l1, l2}

perfectly works!!

enter image description here

$\endgroup$

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