I've been trying to do this there's a few days and the following code was the best that I got until now.
- This is supposed to be one graph;
- Because I say
axis y line=none
the last three "blocks" of the graph don't show the "ymajorgrids"; - Another problem are the "spaces" between the "blocks", I tried to solve this using the
\hspace{3.7cm}
, but if I keep the value small enough to looks like one graph, the bars between 30% and 10% will be too close from each other; - I tried "groupplots" but "no lucky";
- If I use the
\documentclass{standalone}
I'm not able to view the entire graph.
Code:
\documentclass{article}
\usepackage{tikz,pgfplots,rotating,mathpazo}
\pgfplotsset{compat=1.13}
%\usepackage[active,tightpage]{preview}
%\PreviewEnvironment{tikzpicture}
%\setlength\PreviewBorder{5pt}
\begin{document}
\begin{tikzpicture}[scale=0.60]
\pgfplotsset{scale only axis,}
\pgfplotsset{every axis legend/.append style={draw=none,
at={(0,-0.3)},
anchor=south,legend columns=-1}}
% Begin 30' Figure
\begin{axis}[
xtick={10,20,30},
xticklabels={$10\%$,$20\%$,$30\%$},
axis y line*=left,
ymin=0,ymax=0.035,
xlabel=$30'$,
ylabel=$MSE$,
ybar, x=0.2cm, enlarge x limits={abs=0.75cm},
ymajorgrids,
]
\addplot[black!100!white,fill=black!100!white,]
coordinates{(10,0.00495)(20,0.00418)(30,0.00565)};%\addlegendentry{$BP$}\label{HplotBP}
\addplot[black!15!white,fill=black!15!white,]
coordinates{(10,0.00241)(20,0.00233)(30,0.00234)};%\addlegendentry{$PSO$}\label{HplotPSO}
\addplot[black!50!white,fill=black!50!white,]
coordinates{(10,0.00240)(20,0.00233)(30,0.00241)};%\addlegendentry{$PSO-AWF$}\label{HplotPSO-AWF}
\end{axis}
\begin{axis}[
axis y line=none,
axis x line=none,
ymin=0,ymax=3000,
ylabel=$Run$ $Time$ $(s)$,
x=0.2cm, enlarge x limits={abs=0.75cm},
]
\addplot[smooth,mark=*,black!100!white] coordinates{(10,9.7409)(20,15.8253)(30,21.9555)};
\addplot[smooth,mark=*,black!15!white] coordinates{(10,856.4934)(20,1685.4893)(30,2508.6612)};
\addplot[smooth,mark=*,black!50!white] coordinates{(10,466.1263)(20,951.3380)(30,1328.8989)};
\end{axis}
% End 30' Figure
\hspace{3.7cm}% NO SPACE!
% Begin 1h Figure
\begin{axis}[
xtick={10,20,30},
xticklabels={$10\%$,$20\%$,$30\%$},
axis y line=none,
ymin=0,ymax=0.035,
xlabel=$1h$,
ylabel=$MSE$,
ybar, x=0.2cm, enlarge x limits={abs=0.75cm},
ymajorgrids,
]
\addplot[black!100!white,fill=black!100!white,]
coordinates{(10,0.01105)(20,0.00848)(30,0.01018)};%\addlegendentry{$BP$}\label{HplotBP}
\addplot[black!15!white,fill=black!15!white,]
coordinates{(10,0.00409)(20,0.00409)(30,0.00409)};%\addlegendentry{$PSO$}\label{HplotPSO}
\addplot[black!50!white,fill=black!50!white,]
coordinates{(10,0.00407)(20,0.00409)(30,0.00412)};%\addlegendentry{$PSO-AWF$}\label{HplotPSO-AWF}
\end{axis}
\begin{axis}[
axis y line=none,
axis x line=none,
ymin=0,ymax=3000,
ylabel=$Run$ $Time$ $(s)$,
x=0.2cm, enlarge x limits={abs=0.75cm},
]
\addplot[smooth,mark=*,black!100!white] coordinates{(10,9.9127)(20,15.7465)(30,22.0166)};
\addplot[smooth,mark=*,black!15!white] coordinates{(10,846.4655)(20,1674.5623)(30,2488.7022)};
\addplot[smooth,mark=*,black!50!white] coordinates{(10,468.0651)(20,939.3421)(30,1312.1089)};
\end{axis}
% End 1h Figure
\hspace{3.7cm}% NO SPACE!
% Begin 3h Figure
\begin{axis}[
xtick={10,20,30},
xticklabels={$10\%$,$20\%$,$30\%$},
axis y line=none,
ymin=0,ymax=0.035,
xlabel=$3h$,
ylabel=$MSE$,
ybar, x=0.2cm, enlarge x limits={abs=0.75cm},
ymajorgrids,
]
\addplot[black!100!white,fill=black!100!white,]
coordinates{(10,0.02303)(20,0.02103)(30,0.01911)};%\addlegendentry{$BP$}\label{HplotBP}
\addplot[black!15!white,fill=black!15!white,]
coordinates{(10,0.01069)(20,0.01078)(30,0.01086)};%\addlegendentry{$PSO$}\label{HplotPSO}
\addplot[black!50!white,fill=black!50!white,]
coordinates{(10,0.01066)(20,0.01110)(30,0.01124)};%\addlegendentry{$PSO-AWF$}\label{HplotPSO-AWF}
\end{axis}
\begin{axis}[
axis y line=none,
axis x line=none,
ymin=0,ymax=3000,
ylabel=$Run$ $Time$ $(s)$,
x=0.2cm, enlarge x limits={abs=0.75cm},
]
\addplot[smooth,mark=*,black!100!white] coordinates{(10,7.37)(20,14.57)(30,21.34)}; \addlegendentry{$BP$}
\addplot[smooth,mark=*,black!15!white] coordinates{(10,908.04)(20,1804.93)(30,2722.43)}; \addlegendentry{$PSO$}
\addplot[smooth,mark=*,black!50!white] coordinates{(10,428.61)(20,873.12)(30,1315.82)}; \addlegendentry{$PSO-AWF$}
\end{axis}
% End 3h Figure
\hspace{3.7cm}% NO SPACE!
% Begin 6h Figure
\begin{axis}[
xtick={10,20,30},
xticklabels={$10\%$,$20\%$,$30\%$},
axis y line=none,
ymin=0,ymax=0.035,
xlabel=$6h$,
ylabel=$MSE$,
ybar, x=0.2cm, enlarge x limits={abs=0.75cm},
ymajorgrids,
]
\addplot[black!100!white,fill=black!100!white,]
coordinates{(10,0.03107)(20,0.02478) (30,0.02055)};%\addlegendentry{$BP$}\label{HplotBP}
\addplot[black!15!white,fill=black!15!white,]
coordinates{(10,0.01616)(20,0.01617)(30,0.01729)};%\addlegendentry{$PSO$}\label{HplotPSO}
\addplot[black!50!white,fill=black!50!white,]
coordinates{(10,0.01589)(20,0.01640)(30,0.01653)};%\addlegendentry{$PSO-AWF$}\label{HplotPSO-AWF}
\end{axis}
\begin{axis}[
axis y line*=right,
axis x line=none,
ymin=0,ymax=3000,
ylabel=$Run$ $Time$ $(s)$,
x=0.2cm, enlarge x limits={abs=0.75cm},
]
\addplot[smooth,mark=*,black!100!white] coordinates{(10,9.74) (20,15.72)(30,22.11)};
\addplot[smooth,mark=*,black!15!white] coordinates{(10,852.99)(20,1676.16)(30,2505.78)};
\addplot[smooth,mark=*,black!50!white] coordinates{(10,443.05)(20,841.54)(30,1281.74)};
\end{axis}
% End 6h Figure
\end{tikzpicture}
\end{document}