\begin{tikzpicture}
\begin{axis}[
width=5in,
nodes near coords,
height=1.4in,
y grid style = empty,
extra y tick style={grid=none},
at={(0.758in,0.981in)},
scale only axis,
clip=false,
axis on top,
xmin=0,
xmax=5,
xtick={1,2,3,4},
xticklabels={0.00-0.20,0.21-1.00,1.00-2.00,více},
ytick={0,1,2,3,4,5,6,7},
ymin=0,
ymax=8,
ylabel={},
every axis plot/.append style={
ybar,
bar width=0.8cm,
bar shift=0pt,
fill
}
]
\addplot[blue]coordinates{(1,1)};
\addplot[blue]coordinates{(2,2)};
\addplot[blue]coordinates{(3,2)};
\addplot[blue]coordinates{(4,1)};
\end{axis}
\end{tikzpicture}
老实说,我对此感到羞愧,因为我只知道几个命令,因为我只是从另一个“问题”主题中复制了它……但我希望
0,00-0,20 而不是 0.00-0.20
我在这里找到了一些代码
/pgf/number format/.cd,
use comma,
1000 sep={}]
\addplot +[domain=0:1] {(x+rnd)*4000};
但就我的情况而言,它并不能解决问题。
我会很高兴听到大家的建议,谢谢大家。
答案1
最简单的方法是:
\documentclass[margin=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=5in,
nodes near coords,
height=1.4in,
y grid style = empty,
extra y tick style={grid=none},
at={(0.758in,0.981in)},
scale only axis,
clip=false,
axis on top,
xmin=0,
xmax=5,
xtick={1,2,3,4},
xticklabels={{0,00-0,20},{0,21-1,00},{1,00-2,00},více},% <------
ytick={0,1,2,3,4,5,6,7},
ymin=0,
ymax=8,
ylabel={},
every axis plot/.append style={
ybar,
bar width=0.8cm,
bar shift=0pt,
fill
}
]
\addplot[blue]coordinates{(1,1)};
\addplot[blue]coordinates{(2,2)};
\addplot[blue]coordinates{(3,2)};
\addplot[blue]coordinates{(4,1)};
\end{axis}
\end{tikzpicture}
\end{document}