0
$\begingroup$

I have a Barchart like this:

data = {{1995, 0.5, 0.2, 0.3}, {1996, 0.4, 0.3, 0.3}, {1997, 0.5, 0.1,
     0.4}, {1998, 0.6, 0.1, 0.3}, {1999, 0.9, 0, 0.1}, {2000, 0.5, 
    0.2, 0.3}, {2001, 0.5, 0.5, 0}, {2002, 0.5, 0.5, 0}, {2003, 0.5, 
    0.5, 0}, {2004, 0.3, 0.7, 0}, {2005, 0.1, 0.9, 0}};
BarChart[data[[All, 2 ;; 4]], ChartLayout -> "Percentile", 
 Frame -> {True, True, False, False}, 
 PlotRange -> {{All, All}, {All, All}}, 
 PlotRangePadding -> {{0, 0.3}, {0, 0}}, 
 PlotLabel -> Style["Label", Black, 18], 
 FrameLabel -> {None, Style["relative share [%]", 14]}, 
 ChartLabels -> {Placed[IntegerPart[data[[All, 1]]], Axis, 
    Rotate[#, Pi/2] &], None}, ChartLegends -> {"1", "2", "3"}, 
 ChartStyle -> {Red, Blue, Green}, BarSpacing -> {0, 1}, 
 LabelStyle -> {FontFamily -> "Arial", 12}, 
 BaseStyle -> {FontFamily -> "Arial", 12}, ImageSize -> {700, 400}]

Now I have some events which occur in specific years like in this timeline:

timeline = 
TimelinePlot[{Labeled[DateObject[{1998}], "Event A"], 
  Labeled[DateObject[{2001}], "Event B"], 
  Labeled[DateObject[{2005}], "Event C"]}]

Now I want to combine theses two plots so that the timeline is under the barchart but it should be well aligned (years in the same position and the callouts below the time axis). Is there a way to do this? Or maybe there is a better solution instead of TimeLinePlot?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.