考虑以下代码:
\documentclass[11pt,twoside,openright]{memoir}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{xcolor}
\definecolor{color1}{RGB}{146,200,180}
\definecolor{color2}{RGB}{124,206,89}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xbar, xmin=0,
y axis line style = { opacity = 0 },
tickwidth = 0pt,
width=12cm, height=3.5cm, enlarge y limits=0.5,
symbolic y coords={a,b},
ytick=data,
bar shift=0pt,
y dir=reverse,
xtick={1, 500000, 1000000},
xticklabels={0, 5 min, 10 min},
]
\addplot+[color1, forget plot] coordinates { (600000,a) };
\addplot+[color2, forget plot] coordinates { (1020000,b) };
\addplot+[white, forget plot] coordinates { (600000,b) };
\addplot [white, forget plot] coordinates { (600000,b) };
\end{axis}
\end{tikzpicture}
\end{document}
它是从哪里来的?我该如何摆脱它?
答案1
您可以使用scaled x ticks=false
来摆脱\cdot 10^{6}
。
\documentclass[11pt,twoside,openright]{memoir}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{xcolor}
\definecolor{color1}{RGB}{146,200,180}
\definecolor{color2}{RGB}{124,206,89}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xbar, xmin=0,
y axis line style = { opacity = 0 },
tickwidth = 0pt,
width=12cm, height=3.5cm, enlarge y limits=0.5,
symbolic y coords={a,b},
ytick=data,
bar shift=0pt,
y dir=reverse,
xtick={1, 500000, 1000000},
xticklabels={0, 5 min, 10 min},
scaled x ticks=false
]
\addplot+[color1, forget plot] coordinates { (600000,a) };
\addplot+[color2, forget plot] coordinates { (1020000,b) };
\addplot+[white, forget plot] coordinates { (600000,b) };
\addplot [white, forget plot] coordinates { (600000,b) };
\end{axis}
\end{tikzpicture}
\end{document}