3
$\begingroup$

How to make both x- and y-axes in log scale for the RegionPlot written below?

RegionPlot[-0.02 < z < 0.0002, {x, -0.00005, 1}, {y, -0.00005, 5}]
$\endgroup$

1 Answer 1

6
$\begingroup$

First, note that the predicate (i.e. the first argument) in your RegionPlot does not actually depend on the variables you're trying to plot over.

To answer your question about log-axes however, you can use ScalingFunctions. To demonstrate, I'll use a predicate example from the documentation:

(Edit 01: Using "SignedLog" instead based on @Bob Hanlon's comment below)

RegionPlot[x^2 + y^3 < 2, {x, -2, 2}, {y, -2, 2}, 
 ScalingFunctions -> {"SignedLog", "SignedLog"}]

enter image description here

Edit 02: "SignedLog" appears to have been introduced to ScalingFunctions recently. You can however define custom ScalingFunctions, e.g. from this answer:

symlog = {
  Function[x, Sign[x] * Log[Abs[x] + 1]], 
  Function[y, Sign[y] * (Exp[Abs[y]] - 1)]};
}

RegionPlot[x^2 + y^3 < 2, {x, -2, 2}, {y, -2, 2}, 
 ScalingFunctions -> {symlog, symlog}

$\endgroup$
10
  • 2
    $\begingroup$ Or since your variables can be negative, "SignedLog", e.g., RegionPlot[x^2 + y^3 < 2, {x, -2, 2}, {y, -2, 2}, ScalingFunctions -> {"SignedLog", "SignedLog"}] $\endgroup$
    – Bob Hanlon
    Apr 15, 2022 at 13:32
  • $\begingroup$ Thanks, @BobHanlon for your answer. However, when I try to implement your suggestion in Mathematica, it is not working. "ScalingFunctions -> {"SignedLog", "SignedLog"}" --- this part is coming out in red color and error is "The function value {SignedLog[{1.}]} is not a list of real numbers \ with dimensions {1} when the arguments are {{1}}". $\endgroup$ Apr 15, 2022 at 17:38
  • 2
    $\begingroup$ @SahabubJahedi - ScalingFunctions was updated in 2021 (v13.0) $\endgroup$
    – Bob Hanlon
    Apr 15, 2022 at 17:54
  • $\begingroup$ @BobHanlon, I see. I am using v12.0. Is there any different way to do this in v12.0? $\endgroup$ Apr 15, 2022 at 17:57
  • 1
    $\begingroup$ @SahabubJahedi: I believe this post answers your question for pre v13.0 "SignedLog" functionality. See updated answer $\endgroup$ Apr 15, 2022 at 19:50

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.