How do I plot an ParametricPlot with the x-axis using an logarithmic scale? Since I need to use an ParametricPlot, I can not use the LogLinPlot[] and I also was not able to find any viable Solution in native Mathematica, so I tried CustomTicks in the SciDraw package. Unfortunately I just renames the Ticks and does not rescale the axis. I also can not use the trick which is used here: Using Show to place a ParametricPlot on a LogLog scale where I just take the Log[x-axis function] as x-axis since I obtain the Parametric Plot directly from an ODE:
eqnA := {a''[x] + a[x] == b*Sin[a[x]]};
condA := {a[0] == a'[0] == 1};
stopCond := {WhenEvent[Evaluate[Re[a[x]] <= 0], xMax = x;
"StopIntegration"]}
system := Join[eqnA, condA, stopCond];
sol = ParametricNDSolve[system, a, {x, 0, \[Infinity]}, {b}]
ParametricPlot[(Flatten@
Last@Transpose[(a[b] /. sol)[{"Grid", "ValuesOnGrid"}]]), {b, .8,
2}, PlotRange -> {Automatic, {-1, 1}},
AxesOrigin -> {Automatic, -1}, AspectRatio -> 1/GoldenRatio,
Ticks -> {LogTicks, LinTicks}, Axes -> True, Frame -> False]
ParametricPlot[(Flatten@
Last@Transpose[(a[b] /. sol)[{"Grid", "ValuesOnGrid"}]]), {b, .8,
2}, PlotRange -> {Automatic, {-1, 1}},
AxesOrigin -> {Automatic, -1}, AspectRatio -> 1/GoldenRatio]
(For this solution to my preceding problem thanks again to george2089 in Parametric Plot from ODE using WhenEvent)
Any tips to solve this Problem would be appreciated.
P.s.: Yes, I am aware that in this simplified example the Plot is just a line along the x-axis. But I use this simple example because the true System of coupled ODEs is to big and bothersome to post here and does not yield more information to solving this Problem. But if anyone is interested: I am solving the TOV equations for General Relativity.
Evaluated -> True
. Also, I recommend usingParametricNDSolveValue
instead, that way you can avoid having to use replacement rules when plotting. $\endgroup$ParametricNDSolveValue
gives the exact same answer asParametricNDSolve
, but returns the function and not aRule
. See below where I use it in your code $\endgroup$