Tikz pgf loglog y 轴和 log x 轴用作威布尔概率网络(德语:“Weibullwahrscheinlichkeitspapier”)

Tikz pgf loglog y 轴和 log x 轴用作威布尔概率网络(德语:“Weibullwahrscheinlichkeitspapier”)

我正在尝试使用 tikz-pgf 实现威布尔概率网络(德语:“Weibullwahrscheinlichkeitspapier”)。

请仔细查看左侧的 y 轴:它不是对数,而是双对数!我想重现此 y 轴和双对数网格。

威布尔概率网络

线性缩放的 y 轴在右侧显示为次要 y 轴。

问题在于左侧 y 轴以对数方式缩放了两倍,即左边y 轴为:

方程对数对数 y 轴


这是我想要实现的目标:

比较单对数和双对数 y 轴


以下是 y 值的表格

y 值表:


我从这里开始:

代码

\documentclass[margin=1cm]{standalone}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}
    \begin{axis}[
        height = 10cm,
        width = 15cm,
        grid=both,
        xmode=log, ymode=log,
        xmin=1e0, xmax=1e4,
        ymin=1e-2, ymax=1,
        ]

    \end{axis}
\end{tikzpicture}

\end{document}

xy 网格

谢谢你!

答案1

我考虑了你问题中的更新,现在我明白你想要什么了。我希望这是你想要的结果。

  1. y coord trafo可以根据需要处理 y 轴值。我在里面放了ln一个常数1e-4,以避免 pgfplots 尝试计算时出现问题ln 0
  2. 第二个轴(右侧)中计算的值来自以下公式。代入 -2、-1.5 等 y 值可得出概率 Pa。

例子

\documentclass[margin=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}

\begin{tikzpicture}
\pgfplotsset{set layers}
\begin{axis}[
/pgfplots/y coord trafo/.code=\pgfmathparse{log10(abs(ln(1.-#1+1e-4)))},
scale only axis,
axis y line*=left,
height = 10cm,
width = 15cm,
grid=both,
xmode=log,
xmin=1e0, xmax=1e4,
ymin=1e-2,ymax=1e0,
ytick={1e-2,3e-2,5e-2,1e-1,3e-1,4e-1,6.3212055883e-1,8e-1,9e-1,9.9e-1,9.99e-1,1e0},
yticklabels={0.01,0.03,0.05,0.1,0.3,0.4,0.63,0.8,0.9,0.99,0.999,1},
xlabel=$t\,(\log)$,
ylabel=$P_\mathrm{A}$,
]
\end{axis}%
\begin{axis}[
/pgfplots/y coord trafo/.code=\pgfmathparse{log10(abs(ln(1.-#1+1e-4)))},
scale only axis,
axis y line*=right,
axis x line=none,
height = 10cm,
width = 15cm,
grid=both,
xmode=log,
xmin=1e0, xmax=1e4,
ymin=1e-2,ymax=1e0,
ytick={1e-2,0.03112800566,1e-1,0.27110658589,0.63212055883,0.95767078038,1e0},
yticklabels={-2,-1.5,-1,-0.5,0,0.5,1},
ylabel=$\log\left(-\ln(1-P_\mathrm{A})\right)$,
]
\end{axis}
\end{tikzpicture}

\end{document}

例子

如果您希望左轴上有百分比,请复制以下代码。

\documentclass[margin=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}

\begin{tikzpicture}
\pgfplotsset{set layers}
\begin{axis}[
/pgfplots/y coord trafo/.code=\pgfmathparse{log10(abs(ln(1.-#1+1e-4)))},
scale only axis,
axis y line*=left,
height = 10cm,
width = 15cm,
grid=both,
xmode=log,
xmin=1e0, xmax=1e4,
ymin=1e-2,ymax=1e0,
ytick={1e-2,3e-2,5e-2,1e-1,3e-1,4e-1,6.3212055883e-1,8e-1,9e-1,9.9e-1,9.99e-1,1e0},
yticklabels={1.0,3.0,5.0,10.0,30.0,40.0,63.2,80.0,90.0,99.0,99.9,100.0},
xlabel=$t\,(\log)$,
ylabel=$P_\mathrm{A}\,(\%)$,
]
\end{axis}%
\begin{axis}[
/pgfplots/y coord trafo/.code=\pgfmathparse{log10(abs(ln(1.-#1+1e-4)))},
scale only axis,
axis y line*=right,
axis x line=none,
height = 10cm,
width = 15cm,
grid=both,
xmode=log,
xmin=1e0, xmax=1e4,
ymin=1e-2,ymax=1e0,
ytick={1e-2,0.03112800566,1e-1,0.27110658589,0.63212055883,0.95767078038,1e0},
yticklabels={-2,-1.5,-1,-0.5,0,0.5,1},
ylabel=$\log\left(-\ln(1-P_\mathrm{A})\right)$,
]
\end{axis}
\end{tikzpicture}

\end{document}

例子

相关内容