当我运行此代码时,右下角出现了 10^4,这似乎是错误的。我想去掉这个。左上角有 y 轴的缩放比例。我希望它位于轴的左侧,或者去掉它并写入 ylabel = {$E[\pi_R]$ in $10^9$},
\documentclass[letter,11pt,twoside]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\begin{document}
\definecolor{light-gray}{gray}{0.5}
\definecolor{dark-gray}{gray}{0.2}
\begin{tikzpicture}[
labelnode/.style={font=\footnotesize, above},
labelline/.style={stealth-stealth,shorten >=0.1pt, shorten <=0.5pt}
]
\begin{axis}[
axis lines = left,
xlabel = $c_{S_2}$,
ylabel = {$E[\pi_R]$},
width=14cm,
height=8cm,
xmin=9900, xmax=10100, ymin=6.7*10^9, ymax=8.4*10^9,
xtick={9900,9950,10000,10050,10100},
xticklabels={9900,9950,10000,10050,10100},
]
\addplot [
domain=9900 : 10000,
samples=100,
style=dashed,
color=dark-gray ] {24500000000/3 - 5/4 * x* (40000 + 3 * x)} ; %notcare1 check
\coordinate (l) at (rel axis cs:0,1);
\legend{$E[\dot{\pi}_R]$,$E[\tilde{\pi}_R]$}
\end{axis}
\end{tikzpicture}
\end{document}
我怎样才能做到这一点?
答案1
您只需添加scaled ticks=false
。
\documentclass[letter,11pt,twoside]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usepackage{pgfplotstable}
\begin{document}
\definecolor{light-gray}{gray}{0.5}
\definecolor{dark-gray}{gray}{0.2}
\begin{tikzpicture}[
labelnode/.style={font=\footnotesize, above},
labelline/.style={stealth-stealth,shorten >=0.1pt, shorten <=0.5pt}
]
\begin{axis}[scaled ticks=false,
axis lines = left,
xlabel = $c_{S_2}$,
ylabel = {$E[\pi_R]$},
width=14cm,
height=8cm,
xmin=9900, xmax=10100, ymin=6.7*10^9, ymax=8.4*10^9,
xtick={9900,9950,10000,10050,10100},
xticklabels={9900,9950,10000,10050,10100},
]
\addplot [
domain=9900:10000,
samples=100,
style=dashed,
color=dark-gray ] {24500000000/3 - 5/4 * x* (40000 + 3 * x)} ; %notcare1 check
\coordinate (l) at (rel axis cs:0,1);
\legend{$E[\dot{\pi}_R]$,$E[\tilde{\pi}_R]$}
\end{axis}
\end{tikzpicture}
\end{document}