I want to combine a Plot
and a ListPlot
at their common x-axis. Here's an example of what I've got so far:
fgraph = Plot[1 - x^2
- 0.5654788166963185 E^(-2.25 (-0.2 + x)^2)
- 0.5654788166963185 E^(-2.25 (0.2 + x)^2), {x, -1, 1},
AxesOrigin -> {-1, 0}];
ggraph = ListPlot[
{{{-0.2, 0}, {-0.2, 0.5}}, {{0.2, 0}, {0.2, 0.35}}},
Joined -> True, PlotRange -> {{-1, 1}, {0, All}},
AxesOrigin -> {1, 0}];
GraphicsColumn[{ggraph, fgraph}, Automatic, -112]
It looks pretty close to what I want, but there are a few problems:
- The x-axes are not on the exact same horizontal scale, so they don't line up perfectly,
- The spacing of
-112
inGraphicsColumn
had to be found manually and it's not quite right either, and - I'd like to be able to adjust the top plot's
AspectRatio
to make it around half the current height.
The solution needs to be automated since this is only an example.
Note that I need to keep the two different scales for the y-axis, since the y-axes in fgraph
and ggraph
are measured in different units and may be orders of magnitude different. This problem seems similar to 1 Plot, 2 Scale/Axis but different since I want the same x-axis at y==0
.
Show
Show[ggraph, fgraph, PlotRange -> All, AxesOrigin -> {0, 0}]
$\endgroup$fgraph
andggraph
are measured in different units and may be orders of magnitude different. I'll clarify my question. $\endgroup$