What is the easiest way to plot something like
where either x-y axes pair is independent of the other. I tried combining BarChart
and ListPlot
, but with no success, as the scaling really messes everything up. Any ideas? I have heard about MultiaxisArrangement
, but I am not too sure how that would work with a bar chart.
Here is a working example:
plot1 = BarChart[{1, 2, 3, 4},
ChartLabels ->
Placed[{"data1", "data2", "data3", "data4"}, Below,
Rotate[#, Pi/2] &], ChartStyle -> "Pastel",
AxesLabel -> {None, None}, BarSpacing -> 0.2, AspectRatio -> .5,
ImageSize -> 300, Frame -> True, FrameLabel -> "Number of data",
GridLines -> Automatic, GridLinesStyle -> Directive[LightGray]]
dataPoints = {{1997, 9}, {1998, 14}, {1999, 12}, {2000, 17}, {2001,
17}, {2002, 28}, {2003, 21}, {2004, 16}, {2005, 30}, {2006,
29}, {2007, 31}, {2008, 37}, {2009, 42}, {2010, 62}, {2011,
56}, {2012, 61}, {2013, 54}, {2014, 82}, {2015, 72}, {2016,
76}, {2017, 79}, {2018, 75}, {2019, 58}, {2020, 79}, {2021,
78}, {2022, 80}, {2023, 60}};
plot2 = ListPlot[dataPoints, PlotStyle -> {Black},
PlotMarkers -> {"\[FilledSquare]", 10}, Axes -> False,
Frame -> True,
FrameLabel -> {{None, "Number of events"}, {None, "Year"}},
FrameTicks -> {{None, All}, {None, All}}, AspectRatio -> .5]