1

I am trying to implement a Weibull probability network (german: "Weibullwahrscheinlichkeitspapier") with tikz-pgf.

Please take a closer look at the left y-axis: it is not log, it is double log! I want to reproduce this y-axis and the double log grid.

Weibull probability network

The linearly scaled y-axis is shown on the right as secondary y-axis.

The problem is that the left y-axis is scaled twice logarithmically, that is, the definition of the left y-axis is:

equation loglog y-axis


Here is what I want to achieve:

comparison single log and double log y-axis


Here is a table of the values of y

Table of the values of y:


I started here:

Code

\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}

x-y-grid

Thank you!

1 Answer 1

2

I have considered the update in your question and now I understood what you want. I hope that this is the desired result.

  1. With y coord trafo you can treat you y-axis values as you want. I put inside the ln a constant 1e-4 in order to avoid problems when pgfplots tries to calculate ln 0.
  2. The values calculated in the second axis (the right one) comes from the following equation. Substitute the y-values of -2, -1.5, and so on to get the probabilities Pa.

Example

\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}

Example

If you want it with percentages in the left axis, copy the following code.

\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}

Example

5
  • unfortunately, this is not exactly what I want. I need the left y-axis to be scaled double log according to the equation I mentioned in my question. But thank you anyway :) Mar 25, 2020 at 7:10
  • I can update my answer but I don't understand at all what you want. What do you mean by scaled double log? Could you please add an image or something in order to clarify what you want? Have a nice day. Mar 25, 2020 at 11:14
  • Thank you very much for your efforts, Sebastián! I have added a new image that shows the scaling of the y-axis I want to achieve. Do you understand now? Mar 25, 2020 at 13:48
  • I've just edited my answer! Hope you like it :D @user3116388 Mar 27, 2020 at 1:39
  • 1
    Thank you! This is it! :) Mar 27, 2020 at 7:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .