1

I want to evaluate one property for different materials, that are separated in 6 groups. To do that, I want to make a horizontal bar chart. I have coded the chart, creating a dummy scale in order to have all the names of the materials in the vertical axis (before, it only displayed the names of the materials of the first plot). I cannot separate the groups an even distance from each other as well as the scale I created.

The code I used is the following:

\begin{tikzpicture}
\hspace*{-4.5cm} 
    \begin{axis}[
    xlabel={zT},
    enlargelimits=0.05,
    legend style={at={(0.50,-0.10)},
      anchor=north,legend columns=-1},
   symbolic y coords={Bi\textsubscript{2}Te\textsubscript{2.7}Se\textsubscript{0.3},Bi\textsubscript{0.5}Te\textsubscript{1.5}Se\textsubscript{3},{(BiSb)}\textsubscript{2}Te\textsubscript{3},Bi\textsubscript{0.52}Te\textsubscript{1.48}Se\textsubscript{3},Bi\textsubscript{0.48}Te\textsubscript{1.52}Se\textsubscript{3},Bi\textsubscript{0.4}Te\textsubscript{1.6}Se\textsubscript{3},AgPb\textsubscript{18}SbTe\textsubscript{20},Pb\textsubscript{9.6}Sb\textsubscript{0.2}Te\textsubscript{3}Se\textsubscript{7},{(Pb\textsubscript{0.95}Sn\textsubscript{0.05}Te)}\textsubscript{0.92}{(PbS)}\textsubscript{0.08},K\textsubscript{0.95}Pb\textsubscript{20}Sb\textsubscript{1.2}Te\textsubscript{22},Ag\textsubscript{0.53}Pb\textsubscript{18}Sb\textsubscript{1.2}Te\textsubscript{20},Ag\textsubscript{0.5}Pb\textsubscript{6}Sn\textsubscript{2}Sb\textsubscript{0.2}Te\textsubscript{10},Na\textsubscript{0.95}Pb\textsubscript{20}SbTe\textsubscript{22},Tl\textsubscript{0.02}Pb\textsubscript{0.98}Te,Pb\textsubscript{0.98}Na\textsubscript{0.02}Te\textsubscript{0.85}Se\textsubscript{0.15},PbTe-SrTe doped with Na,PbSe:Al\textsubscript{0.01},Na doped PbSe,Pb\textsubscript{0.92}Sr\textsubscript{0.08}Se,Yb\textsubscript{0.19}Co\textsubscript{4}Sb\textsubscript{12},In\textsubscript{0.25}Co\textsubscript{4}Sb\textsubscript{12},CoSb\textsubscript{2.75}Sn\textsubscript{0.05}Te\textsubscript{0.20},Yb\textsubscript{0.2}Co\textsubscript{4}Sb\textsubscript{12.3},Na\textsubscript{0.48}Co\textsubscript{4}Sb\textsubscript{12},Ba\textsubscript{0.14}In\textsubscript{0.23}Co\textsubscript{4}Sb\textsubscript{11.84},Ba\textsubscript{0.08}La\textsubscript{0.05}Yb\textsubscript{0.04}Co\textsubscript{4}Sb\textsubscript{12},Sr\textsubscript{0.12}Ba\textsubscript{0.18}DD\textsubscript{0.39}Fe\textsubscript{3}CoSb\textsubscript{12},Hf\textsubscript{0.5}Zr\textsubscript{0.25}Ti\textsubscript{0.25}NiSn\textsubscript{0.99}Sb\textsubscript{0.01},Hf\textsubscript{0.8}Ti\textsubscript{0.2}CoSb\textsubscript{0.8}Sn\textsubscript{0.2},Si\textsubscript{80}Ge\textsubscript{20} n-type,Si\textsubscript{80}Ge\textsubscript{20} p-type},
ytick=data]

%Dummy graph:
\newcommand{\dummy}{0.715}% some value in the x range
    \addplot [xbar,transparent,only marks] coordinates {
    (\dummy,Bi\textsubscript{2}Te\textsubscript{2.7}Se\textsubscript{0.3})
    (\dummy,Bi\textsubscript{0.5}Te\textsubscript{1.5}Se\textsubscript{3})
    (\dummy,{(BiSb)}\textsubscript{2}Te\textsubscript{3})
    (\dummy,Bi\textsubscript{0.52}Te\textsubscript{1.48}Se\textsubscript{3})
    (\dummy,Bi\textsubscript{0.48}Te\textsubscript{1.52}Se\textsubscript{3})
    (\dummy,Bi\textsubscript{0.4}Te\textsubscript{1.6}Se\textsubscript{3})

    (\dummy,AgPb\textsubscript{18}SbTe\textsubscript{20})
    (\dummy,Pb\textsubscript{9.6}Sb\textsubscript{0.2}Te\textsubscript{3}Se\textsubscript{7})
    (\dummy,{(Pb\textsubscript{0.95}Sn\textsubscript{0.05}Te)}\textsubscript{0.92}{(PbS)}\textsubscript{0.08})
    (\dummy,K\textsubscript{0.95}Pb\textsubscript{20}Sb\textsubscript{1.2}Te\textsubscript{22})
    (\dummy,Ag\textsubscript{0.53}Pb\textsubscript{18}Sb\textsubscript{1.2}Te\textsubscript{20})
    (\dummy,Ag\textsubscript{0.5}Pb\textsubscript{6}Sn\textsubscript{2}Sb\textsubscript{0.2}Te\textsubscript{10})
    (\dummy,Na\textsubscript{0.95}Pb\textsubscript{20}SbTe\textsubscript{22})
    (\dummy,Tl\textsubscript{0.02}Pb\textsubscript{0.98}Te)
    (\dummy,Pb\textsubscript{0.98}Na\textsubscript{0.02}Te\textsubscript{0.85}Se\textsubscript{0.15})
    (\dummy,PbTe-SrTe doped with Na)

    (\dummy,Yb\textsubscript{0.19}Co\textsubscript{4}Sb\textsubscript{12})
    (\dummy,In\textsubscript{0.25}Co\textsubscript{4}Sb\textsubscript{12})
    (\dummy,CoSb\textsubscript{2.75}Sn\textsubscript{0.05}Te\textsubscript{0.20})
    (\dummy,Yb\textsubscript{0.2}Co\textsubscript{4}Sb\textsubscript{12.3})
    (\dummy,Na\textsubscript{0.48}Co\textsubscript{4}Sb\textsubscript{12})
    (\dummy,Ba\textsubscript{0.14}In\textsubscript{0.23}Co\textsubscript{4}Sb\textsubscript{11.84})
    (\dummy,Ba\textsubscript{0.08}La\textsubscript{0.05}Yb\textsubscript{0.04}Co\textsubscript{4}Sb\textsubscript{12})
    (\dummy,Sr\textsubscript{0.12}Ba\textsubscript{0.18}DD\textsubscript{0.39}Fe\textsubscript{3}CoSb\textsubscript{12})

    (\dummy,PbSe:Al\textsubscript{0.01})
    (\dummy,Na doped PbSe)
    (\dummy,Pb\textsubscript{0.92}Sr\textsubscript{0.08}Se)

    (\dummy,Hf\textsubscript{0.5}Zr\textsubscript{0.25}Ti\textsubscript{0.25}NiSn\textsubscript{0.99}Sb\textsubscript{0.01})
    (\dummy,Hf\textsubscript{0.8}Ti\textsubscript{0.2}CoSb\textsubscript{0.8}Sn\textsubscript{0.2})        

    (\dummy,Si\textsubscript{80}Ge\textsubscript{20} n-type)
    (\dummy,Si\textsubscript{80}Ge\textsubscript{20} p-type)
};

%BiTe alloys:
\addplot[xbar,fill=purple] coordinates {
    (1.04,Bi\textsubscript{2}Te\textsubscript{2.7}Se\textsubscript{0.3})
    (1.40,Bi\textsubscript{0.5}Te\textsubscript{1.5}Se\textsubscript{3})
    (1.47,{(BiSb)}\textsubscript{2}Te\textsubscript{3})
    (1.56,Bi\textsubscript{0.52}Te\textsubscript{1.48}Se\textsubscript{3})
    (1.50,Bi\textsubscript{0.48}Te\textsubscript{1.52}Se\textsubscript{3})
    (1.80,Bi\textsubscript{0.4}Te\textsubscript{1.6}Se\textsubscript{3})
};
%PbTe alloys:
\addplot[xbar,fill=violet] coordinates {
    (2.20,AgPb\textsubscript{18}SbTe\textsubscript{20})
    (1.20,Pb\textsubscript{9.6}Sb\textsubscript{0.2}Te\textsubscript{3}Se\textsubscript{7})
    (1.50,{(Pb\textsubscript{0.95}Sn\textsubscript{0.05}Te)}\textsubscript{0.92}{(PbS)}\textsubscript{0.08})
    (1.60,K\textsubscript{0.95}Pb\textsubscript{20}Sb\textsubscript{1.2}Te\textsubscript{22})
    (1.70,Ag\textsubscript{0.53}Pb\textsubscript{18}Sb\textsubscript{1.2}Te\textsubscript{20})
    (1.45,Ag\textsubscript{0.5}Pb\textsubscript{6}Sn\textsubscript{2}Sb\textsubscript{0.2}Te\textsubscript{10})
    (1.70,Na\textsubscript{0.95}Pb\textsubscript{20}SbTe\textsubscript{22})
    (1.50,Tl\textsubscript{0.02}Pb\textsubscript{0.98}Te)
    (1.80,Pb\textsubscript{0.98}Na\textsubscript{0.02}Te\textsubscript{0.85}Se\textsubscript{0.15})
    (2.20,PbTe-SrTe doped with Na)
};
%PbSe alloys:
\addplot[xbar,fill=pink] coordinates {
    (1.00,Yb\textsubscript{0.19}Co\textsubscript{4}Sb\textsubscript{12})
    (1.20,In\textsubscript{0.25}Co\textsubscript{4}Sb\textsubscript{12})
    (1.10,CoSb\textsubscript{2.75}Sn\textsubscript{0.05}Te\textsubscript{0.20})
    (1.30,Yb\textsubscript{0.2}Co\textsubscript{4}Sb\textsubscript{12.3})
    (1.25,Na\textsubscript{0.48}Co\textsubscript{4}Sb\textsubscript{12})
    (1.34,Ba\textsubscript{0.14}In\textsubscript{0.23}Co\textsubscript{4}Sb\textsubscript{11.84})
    (1.70,Ba\textsubscript{0.08}La\textsubscript{0.05}Yb\textsubscript{0.04}Co\textsubscript{4}Sb\textsubscript{12})
    (1.30,Sr\textsubscript{0.12}Ba\textsubscript{0.18}DD\textsubscript{0.39}Fe\textsubscript{3}CoSb\textsubscript{12})
};
%Skutterudites:
\addplot[xbar,fill=orange] coordinates {
    (1.3,PbSe:Al\textsubscript{0.01})
    (1.2,Na doped PbSe)
    (1.5,Pb\textsubscript{0.92}Sr\textsubscript{0.08}Se)
};
%Half-heuslers:
\addplot[xbar,fill=magenta] coordinates {
    (1,Hf\textsubscript{0.5}Zr\textsubscript{0.25}Ti\textsubscript{0.25}NiSn\textsubscript{0.99}Sb\textsubscript{0.01})
    (1,Hf\textsubscript{0.8}Ti\textsubscript{0.2}CoSb\textsubscript{0.8}Sn\textsubscript{0.2})
};   
%Si-Ge alloys:
\addplot[xbar,fill=red] coordinates {
    (1.30,Si\textsubscript{80}Ge\textsubscript{20} n-type)
    (0.95,Si\textsubscript{80}Ge\textsubscript{20} p-type)
};   
 \legend{ ,BiTe alloys,PbTe alloys,PbSe alloys,Skurredites,Half-heuslers,Si-Ge alloys}
 \end{axis}
 \end{tikzpicture}

It looks like this

What it looks like now

, but I want it to look like this:

What I want it to look

Is there a way to do this? If anyone could help, I would be much obliged!

1 Answer 1

2

A quick fix is to simply add a few empty coordinates in the symbolic y coords list. So for example

Hf\tss{0.8}Ti\tss{0.2}CoSb\tss{0.8}Sn\tss{0.2},,Si\tss{80}Ge\tss{20}

instead of

Hf\tss{0.8}Ti\tss{0.2}CoSb\tss{0.8}Sn\tss{0.2},Si\tss{80}Ge\tss{20} 

Note the extra comma. (I defined \tss as a shorthand for \textsubscript.)

A couple of other modifications:

  • I added a height=15cm, with the default settings things were more cramped. You probably need to remove that in your own code.
  • Instead of the dummy plot at first, I set xmin=0.715, ytick distance=1,tickwidth=0, and removed ytick=data.

output of code below

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\newcommand\tss\textsubscript %
\begin{document}
\begin{tikzpicture}
\begin{axis}[
    height=15cm, % added, you probably want to remove this
    xmin=0.715, % added
    ytick distance=1, % instead of ytick=data
    tickwidth=0, % to hide the ticks that would otherwise show up between the bars
    xlabel={zT},
    enlargelimits=0.05,
    legend style={at={(0.50,-0.10)},
      anchor=north,legend columns=-1},
   symbolic y coords={Bi\tss{2}Te\tss{2.7}Se\tss{0.3},Bi\tss{0.5}Te\tss{1.5}Se\tss{3},{(BiSb)}\tss{2}Te\tss{3},Bi\tss{0.52}Te\tss{1.48}Se\tss{3},Bi\tss{0.48}Te\tss{1.52}Se\tss{3},Bi\tss{0.4}Te\tss{1.6}Se\tss{3},,AgPb\tss{18}SbTe\tss{20},Pb\tss{9.6}Sb\tss{0.2}Te\tss{3}Se\tss{7},{(Pb\tss{0.95}Sn\tss{0.05}Te)}\tss{0.92}{(PbS)}\tss{0.08},K\tss{0.95}Pb\tss{20}Sb\tss{1.2}Te\tss{22},Ag\tss{0.53}Pb\tss{18}Sb\tss{1.2}Te\tss{20},Ag\tss{0.5}Pb\tss{6}Sn\tss{2}Sb\tss{0.2}Te\tss{10},Na\tss{0.95}Pb\tss{20}SbTe\tss{22},Tl\tss{0.02}Pb\tss{0.98}Te,Pb\tss{0.98}Na\tss{0.02}Te\tss{0.85}Se\tss{0.15},PbTe-SrTe doped with Na,,PbSe:Al\tss{0.01},Na doped PbSe,Pb\tss{0.92}Sr\tss{0.08}Se,,Yb\tss{0.19}Co\tss{4}Sb\tss{12},In\tss{0.25}Co\tss{4}Sb\tss{12},CoSb\tss{2.75}Sn\tss{0.05}Te\tss{0.20},Yb\tss{0.2}Co\tss{4}Sb\tss{12.3},Na\tss{0.48}Co\tss{4}Sb\tss{12},Ba\tss{0.14}In\tss{0.23}Co\tss{4}Sb\tss{11.84},Ba\tss{0.08}La\tss{0.05}Yb\tss{0.04}Co\tss{4}Sb\tss{12},Sr\tss{0.12}Ba\tss{0.18}DD\tss{0.39}Fe\tss{3}CoSb\tss{12},,Hf\tss{0.5}Zr\tss{0.25}Ti\tss{0.25}NiSn\tss{0.99}Sb\tss{0.01},Hf\tss{0.8}Ti\tss{0.2}CoSb\tss{0.8}Sn\tss{0.2},,Si\tss{80}Ge\tss{20} n-type,Si\tss{80}Ge\tss{20} p-type},
]


%BiTe alloys:
\addplot[xbar,fill=purple] coordinates {
    (1.04,Bi\tss{2}Te\tss{2.7}Se\tss{0.3})
    (1.40,Bi\tss{0.5}Te\tss{1.5}Se\tss{3})
    (1.47,{(BiSb)}\tss{2}Te\tss{3})
    (1.56,Bi\tss{0.52}Te\tss{1.48}Se\tss{3})
    (1.50,Bi\tss{0.48}Te\tss{1.52}Se\tss{3})
    (1.80,Bi\tss{0.4}Te\tss{1.6}Se\tss{3})
};
%PbTe alloys:
\addplot[xbar,fill=violet] coordinates {
    (2.20,AgPb\tss{18}SbTe\tss{20})
    (1.20,Pb\tss{9.6}Sb\tss{0.2}Te\tss{3}Se\tss{7})
    (1.50,{(Pb\tss{0.95}Sn\tss{0.05}Te)}\tss{0.92}{(PbS)}\tss{0.08})
    (1.60,K\tss{0.95}Pb\tss{20}Sb\tss{1.2}Te\tss{22})
    (1.70,Ag\tss{0.53}Pb\tss{18}Sb\tss{1.2}Te\tss{20})
    (1.45,Ag\tss{0.5}Pb\tss{6}Sn\tss{2}Sb\tss{0.2}Te\tss{10})
    (1.70,Na\tss{0.95}Pb\tss{20}SbTe\tss{22})
    (1.50,Tl\tss{0.02}Pb\tss{0.98}Te)
    (1.80,Pb\tss{0.98}Na\tss{0.02}Te\tss{0.85}Se\tss{0.15})
    (2.20,PbTe-SrTe doped with Na)
};
%PbSe alloys:
\addplot[xbar,fill=pink] coordinates {
    (1.00,Yb\tss{0.19}Co\tss{4}Sb\tss{12})
    (1.20,In\tss{0.25}Co\tss{4}Sb\tss{12})
    (1.10,CoSb\tss{2.75}Sn\tss{0.05}Te\tss{0.20})
    (1.30,Yb\tss{0.2}Co\tss{4}Sb\tss{12.3})
    (1.25,Na\tss{0.48}Co\tss{4}Sb\tss{12})
    (1.34,Ba\tss{0.14}In\tss{0.23}Co\tss{4}Sb\tss{11.84})
    (1.70,Ba\tss{0.08}La\tss{0.05}Yb\tss{0.04}Co\tss{4}Sb\tss{12})
    (1.30,Sr\tss{0.12}Ba\tss{0.18}DD\tss{0.39}Fe\tss{3}CoSb\tss{12})
};
%Skutterudites:
\addplot[xbar,fill=orange] coordinates {
    (1.3,PbSe:Al\tss{0.01})
    (1.2,Na doped PbSe)
    (1.5,Pb\tss{0.92}Sr\tss{0.08}Se)
};
%Half-heuslers:
\addplot[xbar,fill=magenta] coordinates {
    (1,Hf\tss{0.5}Zr\tss{0.25}Ti\tss{0.25}NiSn\tss{0.99}Sb\tss{0.01})
    (1,Hf\tss{0.8}Ti\tss{0.2}CoSb\tss{0.8}Sn\tss{0.2})
};   
%Si-Ge alloys:
\addplot[xbar,fill=red] coordinates {
    (1.30,Si\tss{80}Ge\tss{20} n-type)
    (0.95,Si\tss{80}Ge\tss{20} p-type)
};   
 \legend{ ,BiTe alloys,PbTe alloys,PbSe alloys,Skurredites,Half-heuslers,Si-Ge alloys}
 \end{axis}
 \end{tikzpicture}
\end{document}

You must log in to answer this question.

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