I am trying to draw a chart with "The Economist" style. With tikz, I draw this chart clumsily, so I would like to know is that possible to draw this chart elegantly with pgfplots.

        \draw[red,thin] (0,0) -- (3.6,0) node [right,color=black,font=\footnotesize] {0};
        \draw[white,thin] (0,0.5) -- (3.6,0.5) node [right,color=black,font=\footnotesize] {10};
        \draw[white,thin] (0,1) -- (3.6,1) node [right,color=black,font=\footnotesize] {20};
        \draw[white,thin] (0,1.5) -- (3.6,1.5) node [right,color=black,font=\footnotesize] {30};
        \draw[white,thin] (0,2) -- (3.6,2) node [right,color=black,font=\footnotesize] {40};
        \draw[white,thin] (0,2.5) -- (3.6,2.5) node [right,color=black,font=\footnotesize] {50};
        \draw[white,thin] (0,3) -- (3.6,3) node [right,color=black,font=\footnotesize] {60};
        \draw[color=blue,fill=blue!40!black,bar width=8pt] 
            plot coordinates {(1.2,0.85)} node [above,color=black,font=\tiny] {WWI};
        \draw[color=blue,fill=blue!60,bar width=8pt] 
            plot coordinates {(2.4,2.5)} node [above,color=black,font=\tiny] {Spanish Flu};
        \draw[color=red,fill=red] (-0.3,4) rectangle (-0.5,4.5);
        \node[below right] at (-0.3,4.5) {
            \fill[blue!90!black!25] (-0.5,4.5) rectangle (4.5,-0.4);

There are some questions:

  1. How to hide y axis but remain the ytick and y major grid?
  2. Can I set the separation space between ticks?
  3. How to add a red rectangle in the title and move it to the upper left corner?

Thank you for your kindly help!

  • 2
    Could you edit your code to turn it into a compilable document?
    – Alan Munn
    Jul 6, 2011 at 2:57

1 Answer 1

  1. To only hide the y axis line but keep the ticks and the grid, you can use y axis line style={opacity=0} to make the line transparent (draw=none doesn't seem to work here).

  2. To specify the interval between the ticks, it is usually easiest to set them using something like ytick={0,10,...,100}.

  3. The rectangle can be added using extra description/.code={...}. The standard coordinate system for TikZ commands in this context is the axis description cs, where (0,0) is the lower left corner of the plot area, and (1,1) is the upper right. You can use values <0 and >1. In this case, I would also typeset the title as an extra description, because it's easier to get the positioning right. To make the rectangle appear snug in the corner, you should set tight background rectangle for the background, otherwise TikZ will add some padding.

Here's an example where I defined a new economist style for an axis environment. The style takes an optional argument to define the title.

As maetra points out, the style seems to have changed at some point in 2012. I have included a second style, economist new that uses a white background and a frame around the labels.

PGFplots chart in The Economist Style

PGFPlots chart in new The Economist Style





        enlarge x limits=1.5,
        nodes near coords,
        every axis plot post/.append style={
            point meta=explicit symbolic
        /tikz/background rectangle/.style={
        tight background,
        show background rectangle,
        cycle list name=economist,
        axis x line*=bottom,
        x axis line style={black},
        axis y line=right,
        y axis line style={opacity=0},
        grid style=white,
        extra description/.code={
            \fill [red] (-0.05,1.15) rectangle +(-1em,6ex);
            \node [anchor=base west, inner sep=0pt] at (0,1.15) {\large\textbf{#1}};
            \node [anchor=base west, inner sep=0pt] at (0,1.075) {\small Million};
    economist new/.style={
        /tikz/background rectangle/.style={
        grid style=gray!50,
        every node near coord/.append style={
            inner sep=2pt,
            outer sep=3pt
    economist new/.default={},

\begin{axis}[economist new=Mortality, ymax=60]
\addplot coordinates {(1,18) [WW1]};
\addplot coordinates {(2,50) [Spanish Flu]};
  • Exactly Jake, my text live version in ubuntu 11.10 was an old one (2009). Now installed Tex Live 2011 and it works!
    – user13167
    Apr 1, 2012 at 12:03
  • Looks great. Is there a way to draw the plots behind the grind? Apr 1, 2012 at 12:29
  • @schmendrich: Thanks! You can just set axis on top to draw the grid lines on top of the plot.
    – Jake
    Apr 1, 2012 at 12:32
  • @Jake, it seems as if the Economist has a different style now, as least on its website: The background is white while the lines are grey. Also if the line crosses the coordinate information like WW1, there is a box around the label.
    – maetra
    Jan 11, 2013 at 10:20
  • @maetra: Ah yes, indeed! I've edited my answer to reflect the changes.
    – Jake
    Jan 11, 2013 at 10:33

You must log in to answer this question.

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