I am trying to replicate a plot like this one in latex. I wonder if anyone has some good example codes to share? many thanks,


  • It's more a drawing, less a bar chart. So I suggest to peek into the pgf-manual, e.g. here: tikz.dev/tutorials-guidelines . Th eelements you'll need from it are node[draw,fill=blue] (bar), draw[->] (for the arrows), node[anchor= ...] (labels). For the brace there are several options. // I suggest to try a little and add code, better sooner than later, to your question.
    – MS-SPO
    Commented Jul 9 at 15:26

1 Answer 1


Something to get you started; keys:

  • absolute positions AND related to the nodes anchors
  • you could switch to matrix placement for more flexibility
  • place basic elements first
  • introduce and modify styles as needed
  • choose your favorite color model from LaTeX or TikZ

From a refactoring perspective the \draw commands qualify for standardization, e.g as a \newcommand.



    bb/.style={ draw,fill=blue!100!cyan!50,
                inner sep=0mm,minimum height=5mm,anchor=west},
    % ~~~ entry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \node[trt]  (T1) at (0,0) {Treated};
    % ~~~ "bars" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \node[bb,minimum width=4cm] (B1) at (3,0) {};
    \node[bb,minimum width=2cm] (B2) at (B1.east) {};
    % ~~~ arrows ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \draw[<-] (B1.south west) -- +(0,-.4) node[an] {Start of follow-up};
    \draw[<-] (B1.south east) -- +(0,-.4) node[an] {First prescription};
  • 1
    this is great! I will try it.
    – Vincent
    Commented Jul 10 at 1:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .