乳胶 pgfplots loglogaxis 缩放

Latex pgfplots loglogaxis scaling

我在 Latex 中有 loglog 轴,我想像这样更改 y 轴的缩放比例:y 轴应签名:5*10e1、10e2、2*10e2 但此数字应以整数显示like: 50, 100, 200. 图表的网格应该保持不变。

\documentclass[12pt]{scrartcl}

\usepackage[paperwidth=18cm, paperheight=12cm]{geometry}

%Digrammzeug
\usepackage{pgfplots}


\begin{document}

\thispagestyle{empty} % um die Seitenzahl zu endfernen
\newgeometry{left=0.1cm, right=0.1cm, top=0.1cm, bottom=0.1cm}


\begin{figure}
   \centering
   \begin{tikzpicture}
   \begin{loglogaxis}[
   axis x line=bottom,
   axis y line=left,
   ymax = 2.1*10^2,
   xlabel=N (log),
  ylabel=$ \mathrm{S_a} $ in MPa (log),
  every axis x label/.style={
     at={(ticklabel* cs:1.05)},
     anchor=west,
  },
  every axis y label/.style={
     at={(ticklabel* cs:1.05)},
     anchor=south,
  },
  ytick={10, 100},  
  scale=1.6,
  grid=both,
  tick align=outside,
  tickpos=left,
  ]

  %Lasth 1
  \node at (axis cs: 10^5.25,10^2.193) {Lasthorizont I};

  %Lasth 2
  \node at (axis cs: 10^6.2,10^1.955) {Lasthorizont II};

  %Lasth 1 - 2 Gerade
  \addplot[black, mark=square*] coordinates { (50966, 155.74) (477468, 90.16)};

  %Lasth 2 - N_D Gerade
  \addplot[black,no marks] coordinates { (477468, 90.16) (2.5*10^6, 60.16677272)};

  %Dauerfestigkeit
  \addplot[black, mark=square*, mark indices={1}] coordinates { (2.5*10^6, 60.16677272) (10^7, 60.16677272)};
  \addplot[black, dotted, no marks] coordinates { (2.5*10^6, 60.16677272) (10^7.3, 60.16677272) };  
  \addplot[black, dashed] coordinates { (10^4, 60.16677272) (2.5*10^6, 60.16677272) };

  %Beschriftung
  \addplot[dashed] coordinates { (2.5*10^6, 60.16677272) (2.5*10^6, 10^1.7)};
  \node at (axis cs: 10^5.4,10^1.85) {Zeitfestigkeit};
  \node at (axis cs: 10^5.4,10^1.74) {Dauerfestigkeit};
  \node at (axis cs: 10^6.85,10^1.73) {$ N_D=2,5\cdot10^6 $};
  \node at (axis cs: 10^4.4,10^1.Cool {$ S_{aD} \approx $ 60.17};

  %Lasthorizont III
  \addplot[black, thick, mark=x] coordinates {(180000, 117.49)};
  \node at (axis cs: 10^5.8, 10^2.07) {Lasthorizont III};

  \end{loglogaxis}
  \end{tikzpicture}
 \end{figure}


\end{document}

我知道这个问题很久以前就有人问过,属于tex.stackexchange.com,但是对于那些正在寻找解决方案却发现这个问题没有答案的人;我找到了一个可行的解决方案,我将在下面分享。 我在@Jake 的 one and two 回答中找到了你问题的答案。


您正在寻找的(我认为)是 axis 环境与 xmode=logymode=log 的组合。为了获得标记的轴,您将其与 log ticks with fixed point 组合。这是一个默认的 pgf 选项,它将修改两个轴。

由于您只要求特定的 y 轴刻度,我将其用于下面的工作示例,使用 pgfplotsset 的新定义。顺便说一句,我用 .Cool 评论了这一行,因为我对此不熟悉并且它给我带来了问题,请随时取消评论。

   \begin{tikzpicture}

   \pgfplotsset{
  log x ticks with fixed point/.style={
      xticklabel={
        \pgfkeys{/pgf/fpu=true}
        \pgfmathparse{exp(\tick)}%
        \pgfmathprintnumber[fixed relative, precision=3]{\pgfmathresult}
        \pgfkeys{/pgf/fpu=false}
      }
  },
  log y ticks with fixed point/.style={
      yticklabel={
        \pgfkeys{/pgf/fpu=true}
        \pgfmathparse{exp(\tick)}%
        \pgfmathprintnumber[fixed relative, precision=3]{\pgfmathresult}
        \pgfkeys{/pgf/fpu=false}
      }
  }
}

   \begin{axis}
   [xmode=log,
   ymode=log,
   log x ticks with fixed point,
   axis x line=bottom,
   axis y line=left,
   ymax = 2.1*10^2,
   xlabel=N (log),
  ylabel=$ \mathrm{S_a} $ in MPa (log),
  every axis x label/.style={
     at={(ticklabel* cs:1.05)},
     anchor=west,
  },
  every axis y label/.style={
     at={(ticklabel* cs:1.05)},
     anchor=south,
  },
  ytick={10, 100},  
  scale=1.6,
  grid=both,
  tick align=outside,
  tickpos=left,
  ]

  %Lasth 1
  \node at (axis cs: 10^5.25,10^2.193) {Lasthorizont I};

  %Lasth 2
  \node at (axis cs: 10^6.2,10^1.955) {Lasthorizont II};

  %Lasth 1 - 2 Gerade
  \addplot[black, mark=square*] coordinates { (50966, 155.74) (477468, 90.16)};

  %Lasth 2 - N_D Gerade
  \addplot[black,no marks] coordinates { (477468, 90.16) (2.5*10^6, 60.16677272)};

  %Dauerfestigkeit
  \addplot[black, mark=square*, mark indices={1}] coordinates { (2.5*10^6, 60.16677272) (10^7, 60.16677272)};
  \addplot[black, dotted, no marks] coordinates { (2.5*10^6, 60.16677272) (10^7.3, 60.16677272) };  
  \addplot[black, dashed] coordinates { (10^4, 60.16677272) (2.5*10^6, 60.16677272) };

  %Beschriftung
  \addplot[dashed] coordinates { (2.5*10^6, 60.16677272) (2.5*10^6, 10^1.7)};
  \node at (axis cs: 10^5.4,10^1.85) {Zeitfestigkeit};
  \node at (axis cs: 10^5.4,10^1.74) {Dauerfestigkeit};
  \node at (axis cs: 10^6.85,10^1.73) {$ N_D=2,5\cdot10^6 $};
  %\node at (axis cs: 10^4.4,10^1.Cool {$ S_{aD} \approx $ 60.17};

  %Lasthorizont III
  \addplot[black, thick, mark=x] coordinates {(180000, 117.49)};
  \node at (axis cs: 10^5.8, 10^2.07) {Lasthorizont III};

  \end{axis}
  \end{tikzpicture}

这提供了下图: