Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

ParametricPlot and log scale axes in Mathematica

  1. Oct 5, 2009 #1

    I have been trying to make a parametric plot with logarithmic axes in Mathematica, but have been unable to find an option to do this. Can someone tell me how to do this? My code is below, and for reference, EnergyScint is the Bethe-Bloch equation for energy deposit for a fully ionized oxygen core passing through a 1/2 inch slab of scintillator, which I am plotting as a function of \beta \gamma

    ParametricPlot[{b (1 - b^2)^(-1/2), EnergyScint}, {b, .1, .999}, PlotRange -> All]

  2. jcsd
  3. Oct 26, 2009 #2

    I do not understand well the problem, but I suppose you are missing to apply the Log[] function to the functions which you want to plot logarithmically. Example:

    Code (Text):
    ParametricPlot[{b (1 - b^2)^(-1/2), Log[10, EnergyScint[b]]}, {b, .1, .999}, PlotRange -> All]
    This will create a SemiLog plot in which the Y axis will have logarithmic scale and the X axis will be linear.

    Hope this helps!
  4. Oct 26, 2009 #3
    Thanks, but what I am really looking for is the tick marks to be logarithmically spaced, the same way LogPlot[] produces tick marks, but as a parametric plot. Your solution does not produce logarithmically scaled tick marks, just the log of the plotted variables on a linear scale.

    After researching this issue, I am beginning to believe that Mathematica is unable to produce such a plot (at least, not simply...) and plotting the Log[] of the variables is indeed the only (highly non-ideal) solution.

  5. Oct 26, 2009 #4
    Maybe this can help:
    http://www-binf.bio.uu.nl/vitaly/mathematica/ [Broken]

    I'd tried it with a simple function (10^x) by just replacing the Plot function with a ParametricPlot[{x,Log[10,10^x]},{x,0,10}] and it worked just fine.

    Hope this does it.
    Last edited by a moderator: May 4, 2017
  6. Oct 26, 2009 #5
    This is the code as I use it:

    Code (Text):

    (* Y-axis has log ticks *)


    step=1;           (* step in logs *)
    y1=0;               (* initial value with a label - log *)
    y2=4;               (* last value with a label - log *)



    ParametricPlot[{t, Log[10, 10^t]}, {t, 0, 10}, Frame -> {True, True, False, False}, FrameTicks -> {Automatic, yticks, {}, yticks2}, PlotRange -> {y1 - 0.00001`, y2}]
  7. Oct 26, 2009 #6
    Thanks, that seems to do the job!
  8. Oct 26, 2009 #7
    You're welcome.

    Anyway it shouldn't be that hard, isn't it? ;)
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook