以下是我现在所拥有的:
有没有办法将逗号改为点,反之亦然?此表是使用以下答案制作的这个问题,所以这基本上是同一件事。
这不是 mwe,但这是图表的代码:
\pgfplotstableread[row sep=\\,col sep=&]{
interval & montecarlo & random\\
1 & 3531.5 & 3.5 \\
2 & 4088.5 & 1.08 \\
3 & 4025.2 & 0.85 \\
4 & 4049.7 & 1.056 \\
5 & 4034.6 & 0.7\\
6 & 4088.1 & 0.9 \\
7 & 4043.5 & 0.3 \\
8 & 4070.0 & 0.4\\
9 & 4058.3 & 0.42\\
10 & 4045.6 & 0.5\\
}\mydata
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[ybar, symbolic x coords={1,2,3,4,5,6,7,8,9,10},
xtick=data, nodes near coords,width=\textwidth, font=\footnotesize]
\addplot table [x=interval, y=montecarlo]{\mydata};
\end{axis}
\end{tikzpicture}
\caption{Tempos médios de deliberação do jogador Monte Carlo por partida} \label{montecarlotempos}
\end{figure}
答案1
在轴选项中使用以下内容:
/pgf/number format/1000 sep={.},/pgf/number format/use comma,
... 设置/pgf/number format/use comma 将逗号设置为小数分隔符,以及/pgf/number format/1000 sep={} 以抑制千位组的分隔符。
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\pgfplotstableread[row sep=\\,col sep=&]{
interval & montecarlo & random\\
1 & 3531.5 & 3.5 \\
2 & 4088.5 & 1.08 \\
3 & 4025.2 & 0.85 \\
4 & 4049.7 & 1.056 \\
5 & 4034.6 & 0.7\\
6 & 4088.1 & 0.9 \\
7 & 4043.5 & 0.3 \\
8 & 4070.0 & 0.4\\
9 & 4058.3 & 0.42\\
10 & 4045.6 & 0.5\\
}\mydata
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[ybar,/pgf/number format/1000 sep={.},/pgf/number format/use comma, symbolic x coords={1,2,3,4,5,6,7,8,9,10},
xtick=data, nodes near coords,width=\textwidth, font=\footnotesize]
\addplot table [x=interval, y=montecarlo]{\mydata};
\end{axis}
\end{tikzpicture}
\caption{Tempos médios de deliberação do jogador Monte Carlo por partida} \label{montecarlotempos}
\end{figure}
\end{document}