TransWikia.com

Label Bars in a Tornado Chart (LaTeX, Pgfplots)

TeX - LaTeX Asked on June 29, 2021

I’m working on a tornado chart and I want to label the 6 horizontal bars.
So far, this is what I’ve got:

pgfplotsset{TornadoPlot/.style={width=textwidth,height=8cm, xmin=-20,xmax=20, line width=1pt, tick style={line width=0.8pt},xmajorgrids=true, minor x tick num=1, tick align=outside, tick pos=left, xbar, bar shift=0pt, enlarge y limits=0.1, ytick distance=1, ytick=empty, visualization depends on={rawx as rawx}, nodes near coords={pgfmathprintnumber{rawx}}, before end axis/.code={
        draw  ({rel axis cs:0,0} -| {axis cs:0,0})
            -- ({rel axis cs:0,1} -| {axis cs:0,0});},},}
begin{figure}[H]
begin{mdframed}
begin{tikzpicture}
    begin{axis}
        [
        TornadoPlot,
        legend style={at={(0.55, -0.1)}, legend columns=-1, draw=none, text width=7em, anchor=north},
        % and we want to limit the range of the bars to the axis limits
        restrict x to domain*={pgfkeysvalueof{/pgfplots/xmin}:pgfkeysvalueof{/pgfplots/xmax}},
        ]
            addplot [fill=black!80] coordinates
            {(-6,3) (-5,2) (-1,1)};
            addplot [fill=black!10]   coordinates
            {(14,5) (10,4) (14,3) (18,2) (10,1) (6,0)};
            legend{not supported, supported}
    end{axis}
    node[font=largebfseries, yshift=2em] (title) at (current bounding box.north){Support in the Literature};
end{tikzpicture}
end{mdframed}
vspace{-1em}caption{Support in the Literature for all the Trust Factors}
end{figure}

I want to label each of the 6 bars with a name.

this is what I got so far

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP