Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to draw a function in a weibull plot. The x axis is log, the y axis however goes with log(-log(1-y)) (as far as I understood it from this site). The y axis looks similar to a log scale but reverses at the center at 10 (goes from 0.1 to 99.9 in %).

The resulting line in this diagramm should be linear for any function of the type

f(x) = 1-exp(-x^b)

I started with a loglogaxis, but that is obviously wrong

\begin{tikzpicture}
\begin{loglogaxis}[scale only axis,
         every axis plot/.append style={line width=2.0pt},
         domain=0.1:20,
         xmin=0,xmax = 20.0,
         ymin=0.1,ymax = 99.9,
         grid=major,
         xtick={1,2,3,4,5,10,20,30,40,50,100,200,300},
         ytick={0.1,0.2,0.3,0.4,0.5,1,2,3,4,5,10,20,30,40,50,60,70,80,90,99,99.9},
%
         xlabel=Lebensdauer $t$,
         ylabel=Ausfallhäufigkeitssumme $R(t)$,
         ]
%
\addplot[domain=0.01:100] gnuplot{ 1-exp(-x**2)};
\end{loglogaxis} 
\end{tikzpicture}

However I can already see that the ticks are all written as powers of 10, but I want them to be linear in all cases. How would that be achieved?

EDIT:

I tried to modify the axis with:

xmode=log,
y coord trafo/.code=\pgfmathparse{(ln(1-ln(1-#1/100))+4.6001)/6.66*100}

but then the y axis tics show not the number but the position on the 0-100 scale which is wrong. And more important: the numbers calculated by tex are wrong. For x= 0.2 it should be 7.84 but tex print out 69.1.

enter image description here

The real y values are shown in this matlab plot which has the correct calculated values:

enter image description here

share|improve this question
    
Looks like a duplicate of tex.stackexchange.com/questions/69032/… Is that right? –  percusse Oct 17 '12 at 20:15
    
This one is a lot more complicated and not solved by a simple coordinate change as in the linked question. See edit of post for more info. –  Matthias Pospiech Oct 17 '12 at 20:49
    
Can this be done in matlab? Thanks –  user22606 Nov 27 '12 at 12:43
    
@bram Sure, you just say wblplot(X). –  Jake Nov 27 '12 at 12:53
add comment

1 Answer

up vote 5 down vote accepted

Here's the example from the link, implemented in PGFPlots:

\documentclass[border=2pt]{standalone}
\usepackage{pgfplots,pgfplotstable}

\begin{document}
\begin{tikzpicture}
\begin{axis}[scale only axis,
        only marks,
         xmin=10,xmax = 1000,
         ymin=0.001, ymax=0.999,
         grid=major,
         xtick={10, 20, 50, 100, 200, 500, 1000},
         ytick={0.001,0.05,0.4,0.99},
         yticklabels={0.1,5,40,99},
        xmode=log,
        log ticks with fixed point,
y coord trafo/.code=\pgfmathparse{ln(-ln(1-#1)))},
y coord inv trafo/.code=\pgfmathparse{exp(-exp(-#1-1))}
         ]
%
\addplot [domain=10:1000, sharp plot] {1-exp(-(x/820)^1.96)};
\addplot [mark=o, mark size=1.5, black] table {
96  0.02
147 0.04
202 0.0604
232 0.0813
277 0.1022
278 0.1231
325 0.1439
346 0.1648
354 0.1857
367 0.2066
414 0.228
440 0.2501
471 0.2721
525 0.2942
541 0.3163
542 0.3383
574 0.3604
608 0.3824
631 0.4045
643 0.4265
661 0.4504
669 0.4743
706 0.4982
720 0.5221
722 0.546
738 0.5712
747 0.598
770 0.6248
802 0.6537
841 0.6825
850 0.7114
884 0.7403
893 0.7691
901 0.798
};
\end{axis} 
\end{tikzpicture}

\end{document}
share|improve this answer
    
Works well, but could you explain how th trafo vs inv trafo code works? –  Matthias Pospiech Nov 6 '12 at 21:29
    
@MatthiasPospiech: The inv trafo is used to generate the tick labels. It doesn't work with enough accuracy in this case, though, the labels generated automatically aren't round values, which is why I set the labels manually. Sorry, I should have mentioned that and removed the code line. –  Jake Nov 6 '12 at 21:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.