Alguém pode me mostrar como centralizar isso group plot
? Eu tentei todos os truques do livro tex.stackexchange de postagens semelhantes (por exemplo,Como centralizar figuras grandes no LaTeX e como corrigir linhas curtas justificadas?).
\documentclass[]{article}
\usepackage{pgfplots, alphalph}
\usepgfplotslibrary{groupplots}
\begin{document}
\begin{figure}
\begin{tikzpicture}[font=\footnotesize\sffamily]
\begin{groupplot}[
group style={group size=3 by 2, vertical sep=70pt,
ylabels at=edge left
},
view={0}{90},
width=5.2cm,
height=5.2cm,
scale only axis,
scaled ticks = false,
tick label style={/pgf/number format/fixed},
title={My title},
xlabel={x-axis},
ylabel={y-axis}],
unbounded coords=jump]
]
\nextgroupplot [title={\it{Title 1}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\nextgroupplot [title={\it{Title 2}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\nextgroupplot [title={\it{Title 3}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\nextgroupplot [title={\it{Title 4}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\nextgroupplot [title={\it{Title 5}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\end{groupplot}
\end{tikzpicture}
\end{figure}
\end{document}
Responder1
Seus enredos são muito amplos. Você pode tentar colocar 2 parcelas seguidas em vez de 3. No entanto, sempre há técnicas de caixa que podem ser usadas.
\documentclass[]{article}
\usepackage{pgfplots, alphalph}
\usepgfplotslibrary{groupplots}
\begin{document}
\begin{figure}
\makebox[\textwidth]{%
\begin{tikzpicture}[font=\footnotesize\sffamily]
\begin{groupplot}[
group style={group size=3 by 2, vertical sep=70pt,
ylabels at=edge left
},
view={0}{90},
width=5.2cm,
height=5.2cm,
scale only axis,
scaled ticks = false,
tick label style={/pgf/number format/fixed},
title={My title},
xlabel={x-axis},
ylabel={y-axis}],
unbounded coords=jump]
]
\nextgroupplot [title={\it{Title 1}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\nextgroupplot [title={\it{Title 2}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\nextgroupplot [title={\it{Title 3}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\nextgroupplot [title={\it{Title 4}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\nextgroupplot [title={\it{Title 5}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\end{groupplot}
\end{tikzpicture}
}
\end{figure}
\end{document}
Se for o caso, você deseja centralizar os dois últimos gráficos, você pode usar uma largura adequada para todos os gráficos (para saber quanto deslocar) e usar xshift
como
\nextgroupplot [xshift=1.2in,title={\it{Title 4}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\nextgroupplot [xshift=1.2in,title={\it{Title 5}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
Com table
:
\documentclass[]{article}
\usepackage{pgfplots, alphalph}
\usepgfplotslibrary{groupplots}
\usepackage{filecontents}
\begin{filecontents*}{mydata.dat}
A B
1 4
2 6
3 9
4 2
5 3
\end{filecontents*}
\begin{document}
\begin{figure}
\makebox[\textwidth]{%
\begin{tikzpicture}[font=\footnotesize\sffamily]
\begin{groupplot}[
group style={group size=3 by 2, vertical sep=70pt,
ylabels at=edge left
},
view={0}{90},
width=5.2cm,
height=5.2cm,
scale only axis,
scaled ticks = false,
tick label style={/pgf/number format/fixed},
title={My title},
xlabel={x-axis},
ylabel={y-axis}],
unbounded coords=jump]
]
\nextgroupplot [title={\it{Title 1}}]
\addplot[black, thick, mark=o, only marks]
table[x=A,y=B]{mydata.dat};
\nextgroupplot [title={\it{Title 2}}]
\addplot[black, thick, mark=o, only marks]
table[x=A,y=B]{mydata.dat};
\nextgroupplot [title={\it{Title 3}}]
\addplot[black, thick, mark=o, only marks]
table[x=A,y=B]{mydata.dat};
\nextgroupplot [title={\it{Title 4}}]
\addplot[black, thick, mark=o, only marks]
table[x=A,y=B]{mydata.dat};
\nextgroupplot [title={\it{Title 5}}]
\addplot[black, thick, mark=o, only marks]
table[x=A,y=B]{mydata.dat};
\end{groupplot}
\end{tikzpicture}
}
\end{figure}
\end{document}
e com
\nextgroupplot [xshift=1.2in,title={\it{Title 4}}]
\addplot[black, thick, mark=o, only marks]
table[x=A,y=B]{mydata.dat};
\nextgroupplot [xshift=1.2in,title={\it{Title 5}}]
\addplot[black, thick, mark=o, only marks]
table[x=A,y=B]{mydata.dat};
Responder2
Outra alternativa: adicionar \hspace*{-4cm}
(ajuste quantos centímetros deseja para conseguir uma boa centralização). Por exemplo:
\documentclass[]{article}
\usepackage{pgfplots, alphalph}
\usepgfplotslibrary{groupplots}
\begin{document}
\begin{figure}
\hspace*{-4cm}
\begin{tikzpicture}[font=\footnotesize\sffamily]
\begin{groupplot}[
group style={group size=3 by 2, vertical sep=70pt,
ylabels at=edge left
},
view={0}{90},
width=5.2cm,
height=5.2cm,
scale only axis,
scaled ticks = false,
tick label style={/pgf/number format/fixed},
title={My title},
xlabel={x-axis},
ylabel={y-axis}],
unbounded coords=jump]
]
\nextgroupplot [title={\it{Title 1}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\nextgroupplot [title={\it{Title 2}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\nextgroupplot [title={\it{Title 3}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\nextgroupplot [title={\it{Title 4}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\nextgroupplot [title={\it{Title 5}}]
\addplot[black, thick, mark=o, only marks]
coordinates {
};
\end{groupplot}
\end{tikzpicture}
\end{figure}
\end{document}