“scaled ticks=true”不起作用

“scaled ticks=true”不起作用

我对这些scaled ticks选项有些疑问。

我只想让 10-5位于顶部轴和一些沿线的数字轴...

%scaled ticks=true在所附的代码示例中做了注释。

在此处输入图片描述

谢谢!

\documentclass[crop]{standalone}

\usepackage{tikz}
\usepackage{amsmath}
\usepackage{amssymb,amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\setlength{\textwidth}{10cm}

\begin{document}

    \begin{tikzpicture}[font={\fontsize{10pt}{3}\selectfont}]
      \begin{axis}[ legend pos = north east, legend columns=1,
      grid=major,
      %scaled ticks=true
      legend cell align=left,
      ymode=log,
      width=\textwidth, ymin=0.00001, ymax=0.00005, xmin=1, xmax=30, 
      ylabel={MSE indices \& SSCRB}, xlabel={Shape parameter: $\lambda$},]
    \addplot[red,mark=square*] table[x={x}, y={y}] {SCM.dat}; \addlegendentry{$\varrho_{SCM}$} ;

    \addplot[blue,mark=*] table[x={x}, y={y}] {Tyler.dat}; \addlegendentry{$\varrho_{Tyler}$} 

    \addplot[green!60!black,mark=diamond*] table[x={x}, y={y}] {SSCRB.dat}; \addlegendentry{$\mathrm{SSCRB}$} ;

    \end{axis}
    \end{tikzpicture}
\end{document}

答案1

不幸的是,如果你查看pgfplots手册的相关部分(4.15.3),你会发现:

手动报价

ytick您可以通过手动指定 y 轴的刻度位置 ( ) 和标签 ( yticklabels),并在轴的旁边添加 tikz 节点来模拟设置:

    \begin{tikzpicture}[font={\fontsize{10pt}{3}\selectfont}]
      \begin{axis}[ legend pos = north east, legend columns=1,
      grid=major,
      % scaled ticks=true, % Doesn't work with log axis
      ytick={0.00001, 0.00001585, 0.00002512, 0.00003981, 0.00005}, % 10^{-5}, 10^{-4.8},...
      yticklabels={1,1.6,2.5,4,5}, % ytick values divided by 10^{-5}
      legend cell align=left,
      ymode=log,
      width=\textwidth, ymin=0.00001, ymax=0.00005, xmin=1, xmax=30, 
      ylabel={MSE indices \& SSCRB}, xlabel={Shape parameter: $\lambda$},]
    \end{axis}
      \node at (-1.2,0) {\(\cdot10^{-5}\)}; % Node to indicate scale factor
    \end{tikzpicture}

输出

相关内容