Problem 1: I am trying to generate a bar-chart with 3 bars for each chart. But as you can see from the below output, my x-axis labels are getting repeated twice. X axis labels = {3-6, 6-12, 12-24}
Problem 2: When I compile the code on overleaf, I get the picture in the center in a full and when I paste the code in another document, it occupies lot of space (as the whole pdf page is being coped to another document). Is there any way that when I compile the project, I just get a pdf download which just confined to that image?
Problem 2 output
Problem 1 output:
Latex code:
\documentclass{article}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{pgf}
\usepackage{tikz} % Required for drawing custom shapes
\usetikzlibrary{shapes,arrows,automata}
\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=1.17}
\usetikzlibrary{patterns}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{groupplot}[
legend columns=-1,
%bar width=1pt, % Width of the bar
%, % Distance between the centers of the bars
symbolic x coords={3-6, 6-12, 12-24},
enlarge x limits={abs=0.6cm},
width=1.2\textwidth,
%xtick={3,6,12,24},
height=0.8\textheight,
ymin=0,
ymax=15,
nodes near coords,
every node near coord/.append style={font=\scriptsize},
nodes near coords align={vertical},
xlabel={x},
ylabel={y},
% The distance between the center of the first bar and the left edge
%enlarge y limits=false,
legend entries={{\color{olive}{\tiny Random}},{\color{orange}{\tiny ++Cost}},{\color{teal}{\tiny ++FTE}}},
legend to name=CombinedLegendBar,
footnotesize,
ybar legend,
legend image code/.code={%
\draw[#1] (0cm,-0.1cm) rectangle (0.6cm,0.1cm);
},
% area legend, % This is the alternate option
group style={
group size=3 by 1,
xlabels at=edge bottom,
ylabels at=edge left}]
\nextgroupplot[title={\scriptsize MADDPG}]
\addplot[ybar, fill=olive] coordinates { (3-6, 6.886)};
\addplot[ybar, fill=orange] coordinates { (6-12, 8.501)};
\addplot[ybar, fill=teal] coordinates { (12-24, 10.179)};
%\addplot[ybar, fill=gray] coordinates { (4, 11.14)};
% \addplot[ybar, pattern=north east lines] coordinates { (5, 15.001)};
\nextgroupplot[title={\scriptsize MATD3}]
\addplot[ybar, fill=olive] coordinates { (3-6, 6.886)};
\addplot[ybar, fill=orange] coordinates { (6-12, 8.501)};
\addplot[ybar, fill=teal] coordinates { (12-24, 10.179)};
% \addplot[ybar, fill=gray] coordinates { (4, 11.14)};
% \addplot[ybar, pattern=north east lines] coordinates {(5, 15.001)};
\nextgroupplot[title={\scriptsize MASAC}]
` \addplot[ybar, fill=olive] coordinates { (3-6, 6.886)};
\addplot[ybar, fill=orange] coordinates { (6-12, 8.501)};
\addplot[ybar, fill=teal] coordinates { (12-24, 10.179)};
% \addplot[ybar, fill=gray] coordinates { (4, 11.14)};
% \addplot[ybar, pattern=north east lines] coordinates { (5, 15.001)};
\end{groupplot}
\end{tikzpicture}
\ref{CombinedLegendBar}
\caption{Triage++ Performance}
\label{PlusPlusCombinedBar}
\end{figure}
\end{document}
Can anyone help me with this problem?
Thanks!