# Problem Scaling Logarithmic function PSTricks

I'm trying to plot a function, but with the x-axis logarithmic. I use PSTricks and the package pstricks-addwith the algebraic option, to write my function litterally. My function to be plotted is : I want to have the X-axis logarithmic, from 10^-1 to 10^2... But I can't figure how to do it...

Here's what I tried...

\psset{xunit=2,yunit=6, algebraic}
\begin{pspicture}[showgrid=false](0,0)(2,1)
\psaxes[xlogBase=10, comma,subticks=5,
arrowscale=1.5]{->}(3,0.8)[Voltage (V),-90][Yield (\%),90]
\psplot[linecolor=red]{0.01}{2}{(x/(1+(1+x^2)^0.5))^2}
\end{pspicture}


That generates this : What I want to have is this : Does I have to adapt the function so that it fits the non-logarithmic grid once plotted ? I don't understand the principe of plotting a log function in a non-log grid...

If you could also explain me that it would be great. Here is a solution for PSTricks.

\documentclass[pstricks,border=10pt]{standalone}

\begin{document}

\psset{xunit=2,yunit=6,plotpoints=500,algebraic=true,linewidth=0.5pt,dash=2pt 2pt}

\begin{pspicture}(-1.4,-0.2)(3.9,1.2)
\psaxes[axesstyle=frame,xlogBase=10,comma,logLines=x,dy=0.2,Dy=20,xsubticks=9,
yticksize=0 4,subticklinestyle=dashed,ticklinestyle=dashed,Ox={-1}](-1,0)(3,1.0)[Voltage (V),0][Yield (\%),90]
\psplot[linecolor=red]{-1}{3}{10^x^2/(1+sqrt(1+10^x^2))^2}
\end{pspicture}

\end{document}

• So the trick is to manually transform the function by replacing x with 10^x, correct? – Jake May 26 '14 at 17:54
• Yes indeed ! I'll remember it for the next time ;) Thanks again ! – 3isenHeim May 26 '14 at 17:58
• I am sorry. Your signature name (i.e., Thomas, probably Thomas Söll) is no longer needed in the contents as the user profile link has been automatically attached to the bottom right corner of the post. – kiss my armpit May 26 '14 at 18:06

Here's how you would do this with PGFPlots: \documentclass[border=5mm]{standalone}

\usepackage{pgfplots}
\pgfplotsset{compat=1.10}

\begin{document}
\begin{tikzpicture}%
\begin{axis}[%
xmode = log, % X axis is logarithmic
domain = 1e-1:1e2, % Domain over which the function is evaluated
ymax = 100, % Explicitly set the upper limit of the Y axis (the others are automatically determined)