I would like to make a compound figure comprising three plots. At the upper-right is the "main" plot, showing the trajectory of a point with given $x$ and $y$ coordinates, marked for various values of a parameter, $t$.
At the left I'd like a plot of the vertical ($y$) component, also with points marked for the same values of the parameter $t$. Below I'd like a plot of the horizontal ($x$) component, also with points marked for the values of the parameter $t$. (I'd like this plot rotated, so that the position of points on that plot, left-to-right, correspond to and aligns with the position of corresponding points in the main plot.)
Here is the code:
fx[t_] := Sin[t] + 1/3 Sin[2 t] + 1/5 Sin[3 t + .5] - 1/2 Sin[5 t - .2];
fy[t_] := Cos[t] - 1/2 Sin[3 t] + 1/5 Cos[4 t];
fullplot = ParametricPlot[{fx[t], fy[t]},{t, 0, 1},
PlotStyle -> Thickness[0.015],
Epilog -> {PointSize[0.025],
Table[{Hue[t], Point[{fx[t], fy[t]}]}, {t, 0, 1, .1}]}];
xPlot = Rotate[Plot[fx[t], {t, 0, 1},
Epilog -> {PointSize[0.02],
Table[{Hue[t], Point[{t, fx[t]}]}, {t, 0, 1, .1}]},
ImageSize -> 580], -\[Pi]/2];
yPlot = Plot[fy[t], {t, 0, 1},
Epilog -> {PointSize[0.02],
Table[{Hue[t], Point[{t, fy[t]}]}, {t, 0, 1, .1}]},
ImageSize -> 500];
GraphicsGrid[{{yPlot, fullplot}, {"", xPlot}}]
This is close to what I need, but there are two more requirements, each of which has proven frustrating and awkward to achieve:
- The sizes and alignments of the axes of the component graphs are never quite right, and some plot sections are clipped. I can adjust aspect ratios and overall sizes of individual graphs and then spacings in the GraphicsGrid all by hand, but this is so time consuming, particularly if I want to make several of these compound figures.
- I'd like to better reveal the relation between the component plots and the main plot by drawing a set of horizontal lines from the points on the $y$-axis graph linking to their corresponding points on the main plot, as well as a set of vertical lines from the points on the $x$ graph to their corresponding points on the main plot. [This is the most important portion of my request.]
The closest question I've found is this one, which is't quite what is needed as it just links supporting plots to a main plot--not specific points with the constraint of horizontal and vertical links.
I'm not wedded to using ParametricPlot
and simple Plot
, so if there is a clever and robust method to get my full figure (using Inset
, perhaps?) using other functions, great.