# how to plot multiple plots sharing a common X-axis and Y-axis

With the following Code, I generate various ListLinePlots but I like to create the example figure given below:

ClearAll[data, time];
SeedRandom[21];
data = RandomReal[{1, 100}, {24, 12}];
time = Transpose@{{2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021}};
data1 = PrependTo[data, time // Flatten] // Transpose;
plot1 = ListLinePlot[Transpose[data1][[{2, 3}]], PlotLegends -> {2, 3}];
plot2 = ListLinePlot[Transpose[data1][[{4, 5}]], PlotLegends -> {4, 5}];
plot3 = ListLinePlot[Transpose[data1][[{6, 7}]], PlotLegends -> {6, 7}];
plot4 = ListLinePlot[Transpose[data1][[{8, 9}]], PlotLegends -> {8, 9}];
Row[{plot1, plot2, plot3, plot4}]


In the data matrix data1 the first column is X-axis denoting time (2010, 2011,...,2021) and is common for all countries. For simplicity, the data in the 2nd and 3rd columns represent country 1 for two time-series variables; and the 4th and 5th columns, country 2; etc. I have 12 countries consistent with the data given. There are two labels: blue and orange with names Label 1 and Label 2 as in the example.

This is the plot I like to produce:

• Oct 9 at 14:03
• @BobHanlon: Grid is not really creating the type of plot shown in the example. Thanks Oct 9 at 14:19
• Tugrul, but have you investigated the linked resource function? I am guessing it can be used for such thing as the plot type you want, by simply removing some of the vertical axes/frame edges. Investigating this method should turn fruitful for you. Oct 9 at 15:10
• @CA Trevillian: I did examine it and tried few things. My problem is to create a single X-axis for a group of countries over a fixed time period. This is where I got stuck. Oct 9 at 15:34

ClearAll[data, time];
SeedRandom[21];
data = RandomReal[{1, 100}, {24, 12}];
time = Transpose@{{2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
2018, 2019, 2020, 2021}};
data1 = PrependTo[data, time // Flatten] // Transpose;

plot[n_] := Labeled[
ListLinePlot[
Transpose[data1][[{2 n, 2 n + 1}]],
PlotLegends -> Placed[{2 n, 2 n + 1}, Above],
Ticks -> {{1, 12}, Automatic},
Axes -> If[n == 1, True, {True, False}],
StringForm["Plot ", n], Below]