ParametricPlot and log scale axes in Mathematica

  • Mathematica
  • Thread starter pastro
  • Start date
  • #1
15
0
Hello,

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]

Thanks!
 

Answers and Replies

  • #2
5
0
Hi,

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:
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!
 
  • #3
15
0
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.

Thanks!
 
  • #4
5
0
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:
  • #5
5
0
This is the code as I use it:

Code:
(* Y-axis has log ticks *)

Clear[step,y1,y2,yticks,yticks2];

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


yticks=Join[Flatten[Table[Table[{Log[10,i],""},{i,10^j,10^(step+j),10^(j+(step-1))}],{j,y1,y2-step,step}],1],Table[{i,If[i==-1,"10^-1",If[i<0,("10^-")^-i,("10")^i]]},{i,y1,y2,step}]];


yticks2=Join[Flatten[Table[Table[{Log[10,i],""},{i,10^j,10^(step+j),10^(j+(step-1))}],{j,y1,y2-step,step}],1],Table[{i,""},{i,y1,y2,step}]];

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

Anyway it shouldn't be that hard, isn't it? ;)
 

Related Threads on ParametricPlot and log scale axes in Mathematica

Replies
1
Views
4K
Replies
2
Views
4K
Replies
2
Views
2K
Replies
3
Views
6K
Replies
5
Views
6K
Replies
6
Views
2K
  • Last Post
Replies
2
Views
23K
Replies
5
Views
2K
Replies
5
Views
4K
Top