0
$\begingroup$

I want to plot a RegionPlot in LogLinear scale. If I try with a simple linear scale,

pl = RegionPlot[T < (15.4)^(1/n)*0.001, {T, 0.001, 1000}, {n, 0, 4}, 
Ticks -> {ScientificForm[#], Automatic}, AxesLabel -> {T, n},
Method -> "ScalingFunctions" -> {Automatic, Automatic}]

I obtain this plot (which seems to be ok)

enter image description here

If I try to switch the x-axis to a Log10 scale in this way:

pl = RegionPlot[T < (15.4)^(1/n)*0.001, {T, 0.001, 1000}, {n, 0, 4}, 
Ticks -> {ScientificForm[#], Automatic}, AxesLabel -> {T, n},
Method -> "ScalingFunctions" -> {"Log10", Automatic}]

I obtain the ugly picture

enter image description here

which is definitely not what I want.

If I try to use the suggestion provided in RegionPlot with LogScale using

loglinearRegionPlot[rplot_] := Module[{pts, pgon},
pts = Cases[Normal@rplot, Line[a__] :> a, Infinity];
pgon = {EdgeForm[],
    Directive[RGBColor[0.368417, 0.506779, 0.709798],
     AbsoluteThickness[1.6], Opacity[0.3]],
    Cases[Normal@rplot, Polygon[_], Infinity]};
  ListLogLinearPlot[pts,
   Joined -> True, Frame -> True,
   PlotRange -> All, AspectRatio -> 1,
   Axes -> False, PlotStyle -> ColorData[1][1], 
   Epilog -> (pgon /. {x_?NumericQ, y_?NumericQ} :> {Log@x, y})]]

pl = loglinearRegionPlot@
RegionPlot[T < (15.4)^(1/n)*0.001, {T, 0.001, 1000}, {n, 0, 4},
Ticks -> {ScientificForm[#], Automatic},
AxesLabel -> {T, n}]

I obtain

enter image description here

which is pretty close to what I want, but it doesn't show a nice hyperbole, but those sharpy and polygonal lines and a rectangular shape between 0.01 and 0.1...

What can I do? Thank you!

$\endgroup$
0
$\begingroup$

It seems that ScalingFunctions are not supported by RegionPlot. So, one idea is to include the transformation in your inequality (that is, replace T with 10^T) and plot from Log10[.001] to Log10[1000]. This will produce the desired shape, but the ticks will be wrong. So, you will need to provide the correct ticks as well:

RegionPlot[
    10^T < (15.4)^(1/n) 0.001,
    {T, -3, 3}, 
    {n, 0, 3},
    AxesLabel -> {T,n},
    FrameTicks->{
        Automatic,
        {Charting`ScaledTicks["Log10"],Charting`ScaledFrameTicks[{Log10,10^#&}]}
    },
    PlotRange->All
]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you very much! Is there a way to change the shape of the plot from square to rectangular? $\endgroup$ – Lele May 2 at 20:31
  • $\begingroup$ @Lele Add an AspectRatio option, e.g., AspectRatio -> 1/GoldenRatio. $\endgroup$ – Carl Woll May 2 at 23:31

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.