# How to combine several plots with different $x$ and $y$-axis?

I'm new to Mathematica plots. The following is a small part of my research results:

gthres = 1/3 + (19 - 3 Sqrt[33])^(1/3)/3 + (19 + 3 Sqrt[33])^(1/3)/3;
tthres = Log[gthres];
plot1 = ListLinePlot[{{0.609378, 10}, {0.609379, 8}, {0.609395,
6}, {0.610285, 4}, {0.61073, 3.8}, {0.611392, 3.6}, {0.612376,
3.4}, {0.613835, 3.2}, {0.615994, 3}, {0.619176, 2.8}, {0.62384,
2.6}, {0.630628, 2.4}, {0.640412, 2.2}, {0.654347, 2}, {0.663323,
1.9}, {0.673925, 1.8}, {0.686401, 1.7}, {0.70103, 1.6}, {0.718126,
1.5}, {0.738047, 1.4}, {0.761207, 1.3}, {0.788093, 1.2}},
PlotStyle -> Red, AxesLabel -> {t, k}];
plot2 = ListLinePlot[{{tthres, 10}, {tthres, 0}}, PlotStyle -> Dotted,
AxesLabel -> {t, k}];
plot3 = ListLinePlot[{{0.00025, 0.001}, {0.170589, 1}, {0.261065,
2}, {0.317783, 3}, {0.35709, 4}, {0.386195, 5}, {0.408763,
6}, {0.426861, 7}, {0.44175, 8}, {0.454247, 9}, {0.464908,
10}, {0.482179, 12}, {0.495613, 14}, {0.511024, 17}, {0.522663,
20}, {0.536849, 25}, {0.546988, 30}, {0.55461, 35}, {0.560556,
40}, {0.565329, 45}, {0.569245, 50}}, PlotStyle -> Black,
AxesLabel -> {t, \[Theta]}]


The three plots above have different $$x$$ and $$y$$-axis. I'd like to combine them as one plot, with $$\theta$$ being the left $$y$$-axis, $$k$$ being the right $$y$$-axis, and $$t\in(0,0.8)$$ being the $$x$$-axis. Can anyone give me some hint or help? Thanks in advance!

• tthres is not defined
– kglr
Commented May 22, 2023 at 16:26
• Oh sorry, updated. Commented May 22, 2023 at 16:28
• CombinePlots with multiple axes
– kglr
Commented May 22, 2023 at 16:29
• Yeah I was searching those CombinePlots, but I was having some problem combining different $x$ ranges together. In my case, the $x$ range of plot1 is to the right of tthres and the $x$ range of plot3 is to the left of tthres. Commented May 22, 2023 at 16:33

1. With data1 and data3 the input lists in plot1 and plot3 in OP, find the MinMax of vertical coordinates:
yminmax1 = MinMax @ data1[[All, 2]];
yminmax3 = MinMax @ data3[[All, 2]];

1. Rescale data3 so that it has the same vertical range as data1:
data3rescaled = Transpose[{#, Rescale[#2, yminmax3, yminmax1]} & @@
Transpose[data3]];

1. Plot data1 and data3rescaled together using ListLinePlot. Use tthres as GridLines, and use ChartingFindTicks to get the ticks on the left frame to match the values in data3:
ListLinePlot[{data3rescaled, data1},
GridLines -> {{tthres}, None},
GridLinesStyle -> Directive[AbsoluteThickness[1], Dashed],
PlotStyle -> {Black, Red},
LabelStyle -> 16,
ImageSize -> Large,
Frame -> True,
FrameLabel -> {{θ, k}, {t, None}},
FrameTicks -> {{ChartingFindTicks[yminmax1, yminmax3],  All},
{Automatic, Automatic}}]


• Thanks a lot for your reply! There are two small things (which don't matter anymore though): 1. Need data1={{},{},...}, data3={{},{},...}; 2. The $k$ and $\theta$ axis need to be reversed. Commented May 22, 2023 at 17:41
• fixed the reversed $k$ and $\theta$ axes issue,
– kglr
Commented May 22, 2023 at 17:49