10

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

István Zachar
  • 47,032
  • 20
  • 143
  • 291
Kay
  • 1,035
  • 7
  • 19
  • You tried increasing ImagePadding? – BlacKow Apr 14 '16 at 17:08
  • 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? – Kay Apr 14 '16 at 17:13
  • Setting ImageSize and ImagePadding identical for two plots doesn't make the plot content aligned and identical size? – BlacKow Apr 14 '16 at 17:16
  • @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. – bbgodfrey Apr 14 '16 at 17:19
  • @bbgodfrey - but it looks like it might work (from the first glimpse)... This definitly works. Didn't find a mistake so far! :D – Kay Apr 14 '16 at 17:20
  • @BlacKow interesting idea! I never came up with that. So it seems, that ImagePadding is variable when not fixed? – Kay Apr 14 '16 at 17:21
  • @BlacKow - Do you want to write an answer I can accept? Could you also shortly explain, why this works?? Thx! – Kay Apr 14 '16 at 17:24
  • 2
    Many related: 1337, 4059, 1025, 66350, etc. – István Zachar Apr 14 '16 at 17:53

1 Answers1

5

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

Kay
  • 1,035
  • 7
  • 19