3
$\begingroup$

I have the following two functions

p2modeg1 = (((κ1*cc1)/((Γ + κ1)*(1 + cc1))*(n1 + 1/2) + ((κ1 + Γ*(1 + cc1))/((Γ + κ1)*(1 + cc1)))*(nm + 1/2)) /. {cc1 -> (4*g1^2)/(κ1*Γ), nm -> 300, n1 -> 1/10, n2 -> 1/10}) /. {κ1 -> 1, Γ -> 1/100}
p3AEg1 = (((κ1*cc1)/((κ1*(1 + cc2) + Γ)*(1 + cc2 + cc1))*(n1 + 1/2) + (κ1*cc1*cc2)/((κ1*(1 + cc2) + Γ)*(1 + cc2 + cc1))*(n2 + 1/2) + ((1 + cc2 + cc1)*Γ + κ1 (1 + cc2)^2)/((κ1*(1 + cc2) + Γ)*(1 + cc2 + cc1))*(nm + 1/2)) /. {cc1 -> (4*g1^2)/(κ1*Γ), cc2 -> 4*g2^2/(κ1*κ2), nm -> 300, n1 -> 1/10, n2 -> 1/10}) /. {κ1 -> 1, Γ -> 1/100}

And I wish to make Log-Log plots of these two functions. Doing the regular LogLogPlot

Show[{LogLogPlot[p3AEg1 /. {κ2 -> 20, g2 -> 10}, {g1, 1/100, 100}, PlotStyle -> Directive[Thick, Orange, Dashed], PlotRange -> All], LogLogPlot[p2modeg1, {g1, 1/100, 100}, PlotRange -> All, PlotStyle -> Directive[Thick, Red, Dashed]]}, ImageSize -> Medium, PlotRange -> All]

Gives

enter image description here

Which is all good. However, when I try to include this in SciDraw:

Figure[
 FigurePanel[
  {
   SetOptions[LogTicks, LogPlot -> True];
   FigGraphics[LogLogPlot[p3AEg1 /. {\[Kappa]2 -> 20, g2 -> 10}, {g1, 1/100, 100}, PlotRange -> All, PlotStyle -> Directive[Thick, Orange, Dashed]]];
   FigGraphics[LogLogPlot[p2modeg1, {g1, 1/100, 100}, PlotRange -> All, PlotStyle -> Directive[Thick, Red, Dashed]]];
   FrameTicks -> {LogTicks[0, 3, ShowMinorTicks -> True], LogTicks[0, 3, ShowMinorTicks -> True]};
  },
   XPlotRange -> {0.01, 5}, 
   XFrameLabel -> textit["\!\(\*SubscriptBox[\(g\), \(1\)]\)"],
   YPlotRange -> {0.01, 5}, 
   YFrameLabel -> textit["\!\(\*SubscriptBox[\(n\), \\(b\)]\)+\!\(\*FractionBox[\(1\), \(2\)]\)"]
  ],
  CanvasSize -> {5, 3.5}, CanvasFrame -> True
 ]

I am returned with: enter image description here

Not only is the frame not showing powers of 10, but the curves seems to be skewed and mostly covered by the frame. I wish to show powers of 10 on the y-axis and x-axis and replicate the plot in SciDraw as shown in the first plot. How should I go about doing this?

Thanks!

Edit:I have messed around with the ranges and it turns out that the curves plotted in FigurePanel has axes that shows the Log-ed values whereas the regular LogLogPlot takes the Log-ed values but displays the original axes (0.01 to 100 on the x-axis):

enter image description here

How do I make SciDraw display ticks in powers of 10? The regular LogTicks doesn't work as shown in the y-axis.

$\endgroup$
2
  • $\begingroup$ I did not go through your code, but LogTicks in SciDraw assumes base-10 for the relationship between displayed coordinates and the raw graphics coordinates, while everything else in Mathematica (including LogLogPlot) works with base-e. I usually generate the log ticks manually for SciDraw ... $\endgroup$
    – Szabolcs
    Commented Oct 14, 2018 at 11:00
  • $\begingroup$ @Szabolcs I understand that. But it appears that the curves refuses to scale with the FigurePanel. How do you generate the log ticks manually in this case? $\endgroup$
    – kowalski
    Commented Oct 14, 2018 at 19:02

1 Answer 1

4
$\begingroup$

I have used SciDraw only a few times and the package runs only under my Mathematica V.10.0. A key to one of the potential solutions was on p.3-9 of the manual CustomTicksGuide.pdf. On p.4 the guide says: "This tick function was designed on the assumption that you will be generating your plots with logarithmic axes the "manual" way. That is, as far as the plotting functions are concerned, you are actually generating linear plots, but you have taken the logarithm of either the x-axis or y-axis variable."

If I adopt this basic solution (and use 10 as the base for logarithms), I have to redefine the two functions as:

p2modeg1Alt = p2modeg1 /. g1 -> 10^g1;
p3AEg1Alt = p3AEg1 /. g1 -> 10^g1;

With the package SciDraw being loaded I obtain a basic figure. I don't know why the minor ticks are only on the upper x-axis and the left y-axis.

Figure[
 FigurePanel[
  {
   FigGraphics[
    Plot[Log10[p3AEg1Alt] /. {\[Kappa]2 -> 20, g2 -> 10}, {g1, -3, 
      2},
     PlotRange -> All, PlotStyle -> Directive[Thick, Orange, Dashed]]];

   FigGraphics[Plot[Log10[p2modeg1Alt], {g1, -3, 2},
     PlotRange -> All, PlotStyle -> Directive[Thick, Red, Dashed]]]
   },
  XPlotRange -> {-2, 2}, XTicks -> LogTicks[10, -2, 2],
  YPlotRange -> {-1, 3}, YTicks -> LogTicks[10, -1, 3],

  XFrameLabel -> textit["X axis"], YFrameLabel -> textit["Y axis"]
  ],

 CanvasSize -> {5, 3.5}, CanvasFrame -> True]

enter image description here

$\endgroup$
2
  • $\begingroup$ This is exactly what I'm looking for! My tick marks appear on all sides of the axes so it's all fine (I'm using Mathematica version 11.3 so maybe it's that). I can't stress how important this was to me. Thanks! $\endgroup$
    – kowalski
    Commented Oct 14, 2018 at 20:46
  • $\begingroup$ You are welcome. Without SciDraw one could force to have powers of 10. Therefore use Ticks as follows: Ticks -> {{{0.1, "\!\(\*SuperscriptBox[\(10\), \(-1\)]\)"}, {1, "\!\(\*SuperscriptBox[\(10\), \(0\)]\)"}, {10, "\!\(\*SuperscriptBox[\(10\), \(1\)]\)"}, {100, "\!\(\*SuperscriptBox[\(10\), \(2\)]\)"}}, {{0.1, "\!\(\*SuperscriptBox[\(10\), \(-1\)]\)"}, {1, "\!\(\*SuperscriptBox[\(10\), \(0\)]\)"}, {10, "\!\(\*SuperscriptBox[\(10\), \(1\)]\)"}, {100, "\!\(\*SuperscriptBox[\(10\), \(2\)]\)"}, {1000, "\!\(\*SuperscriptBox[\(10\), \(3\)]\)"}}} $\endgroup$
    – Gommaire
    Commented Oct 15, 2018 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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