Firstly, you need to use AbsoluteThickness
instead of Thickness
, as the latter is relative and is a fraction of the horizontal plot range. Secondly, for precise alignment, you'll have to give both figures the exact same ImagePadding
(just like you did with other options), as otherwise, each plot chooses its own padding depending on the extents of the ticks, labels, etc.
Here's how it will look if you fix these (working code given at the end):
A natural question that arises, is "How do you choose the right ImagePadding
?" Surely, you can't be fiddling with the values all day... The solution is to use this idea to create a function that gets the max padding for both plots, like:
getMaxPadding[p_List] := Map[Max, (BorderDimensions@
Image[Show[#, LabelStyle -> White, Background -> White]] & /@ p) ~Flatten~ {{3}, {2}}, {2}] + 1
I used this function in this answer to align two plots vertically. I'll leave incorporating this into your code as an exercise (not very hard, since my answer shows you how to use it).
The code for the figure above is:
GraphicsColumn[{
Plot[0.125 x^2 + 0.05 x^3 + 0.005 x^4, {x, -8.0, 3.0},
AspectRatio -> .4,
PlotRange -> {{-8, 3}, {-.19, .7}},
Frame -> True,
FrameStyle -> AbsoluteThickness[.003],
FrameLabel -> {Null, "V(x)", "m=1.0, w=0.5, y=2.0, g=1.0"},
FrameTicks -> {{Automatic, Automatic}, {None, All}},
PlotRangePadding -> None,
ImagePadding -> {{40, 1}, {20, 30}}],
Plot[0.5 + 0.2 x, {x, -8.0, 3.0},
AspectRatio -> .4,
PlotRange -> {{-8, 3}, {-1, .9}},
Frame -> True, FrameStyle -> AbsoluteThickness[.003],
FrameLabel -> {"x", "B(x)", Null},
FrameTicks -> {{Automatic, Automatic}, {Automatic, Automatic}},
PlotRangePadding -> None,
ImagePadding -> {{40, 1}, {20, 30}}]
}, ImageSize -> 500, Spacings -> -30]
AbsoluteThickness
instead of justThickness
$\endgroup$PlotGrid
Resource Function for this: resources.wolframcloud.com/FunctionRepository/resources/… $\endgroup$