As someone else here mentioned there are no Log
and LogLog
versions of RegionPlot
, so you can make them yourself. The answer above relies on the user being able to apply the Log function to the input in the correct fashion, but it isn't always obvious which arguments or variables should be given the Log
function in the argument, and which should have their plotting ranges scaled. For example, it's not immediately clear to me how to do the same thing with this simple RegionPlot
,
RegionPlot[x^2 + (y - 1)^3 < 2 && y > 0, {x, -2, 2}, {y, 0, 2.5}]
Even if we figured out how to apply the proper scaling to the arguments and plot ranges, then we have to apply the scaling to the tick marks, using one of the methods described in this answer.
I think a better solution is to use the built-in capabilities of ListLogPlot
and ListLogLogPlot
to do the scaling for us. All we need to do is to extract the points and the polygons from the RegionPlot
and feed them into the appropriate log plotting function. This comes with help from Heike and Kuba,
logRegionPlot[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]};
ListLogPlot[pts,
Joined -> True,
Frame -> True,
PlotRange -> All,
AspectRatio -> 1,
Axes -> False,
PlotStyle -> ColorData[1][1],
Epilog -> (pgon /. {x_, y_?NumericQ} :> {x, Log@y})]
]
and
logLogRegionPlot[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]};
ListLogLogPlot[pts,
Joined -> True,
Frame -> True,
PlotRange -> All,
AspectRatio -> 1,
Axes -> False,
PlotStyle -> ColorData[1][1],
Epilog -> (pgon /. {x_, y_?NumericQ} :> Log@{x, y})]
]
(edit: this was added by request)
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})]]
So it is a simple matter to apply this to the region above,
logRegionPlot@
RegionPlot[x^2 + (y - 1)^3 < 2 && y > 0, {x, -2, 2}, {y, 0, 2.5}]
Another example,
rplot = RegionPlot[{Exp[Abs[x]] <= y <= 100}, {x, 0, 6}, {y, 0, 120}]
{logRegionPlot@rplot,
logLogRegionPlot@rplot,
loglinearRegionPlot@rplot}
The only problem is that I can't figure out how to extract multiple regions from the RegionPlot
and maintain their distinct colors.