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 : Function to be plotted

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}
   \psaxes[xlogBase=10, comma,subticks=5,
            arrowscale=1.5]{->}(3,0.8)[Voltage (V),-90][Yield (\%),90]

That generates this : The Code What I want to have is this : My Objectif

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.


enter image description here Here is a solution for PSTricks.




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

   yticksize=0 4,subticklinestyle=dashed,ticklinestyle=dashed,Ox={-1}](-1,0)(3,1.0)[Voltage (V),0][Yield (\%),90]

| improve this answer | |
  • 1
    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:



    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)
    enlargelimits = false, % Don't add padding
    ylabel = Yield / \%, % Set the labels
    xlabel = Voltage / V,
    grid = both % Draw grid lines for the X and Y axis
  \addplot [very thick, smooth] { 100 * x^2 / (1 + sqrt(1+x^2))^2};
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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