1
$\begingroup$

I have been using ContourPlot for a complicated but analytic function, which does not need numerical calculations. I am confused to see the result looks like the following picture, where the lines which should be straight are wavy. Is here some problems with the plot steps or anything else?

The code is about

ContourPlot[f[a,b,x,y]==f[a,b,g[a],0],{gae, 10^-3, 100}, {gag, 10^-6, 1}, 
ScalingFunctions -> {"Log", "Log"}]

where f is an analytic but complicated function of variables a, b, x, y, while g[a] is a interpolation function of variable a. Moreover, in my plot variables a and b are fixed.

ContourPlot

$\endgroup$
5
  • 2
    $\begingroup$ Welcome! Please post the code along with the image so that people can play around with it and see if they can solve the problem! :) $\endgroup$
    – thorimur
    Commented Mar 28, 2023 at 3:04
  • $\begingroup$ But, this definitely looks numerical to me. Try something like PlotPoints -> 300 (or more)? $\endgroup$
    – thorimur
    Commented Mar 28, 2023 at 3:05
  • 1
    $\begingroup$ @thorimur Thank you for your advice, and it is really useful! I realize that I may ask a trivial question. Perhaps the ContourPlot uses numerical methods to find the boundary? Or maybe it is due to there are interpolation functions among my plotting function. $\endgroup$
    – Link
    Commented Mar 28, 2023 at 3:19
  • $\begingroup$ Hello and welcome to Mma.S.E. As it has already been pointed out, please add the code that can reproduce this issue or a minimal working example. In such a way it's going to be much easier for us to grab the code and try to suggest ways to fix it. Many thanks! $\endgroup$
    – bmf
    Commented Mar 28, 2023 at 3:23
  • $\begingroup$ Also btw, thanks for posting some of the code, but in the future we do actually need all of the code! It should be totally self-contained. The point of having code is so people can copy-paste it into their own notebooks, hit shift+enter, modify it, and try to adjust the output until it works. If there are missing pieces, like f, people probably won't be able to help as effectively! :) $\endgroup$
    – thorimur
    Commented Mar 28, 2023 at 4:21

1 Answer 1

1
$\begingroup$

The problem is solved after I add PlotPoints -> 300 thanks to @thorimur.

Perhaps the problem is due to the interpolation function g[a] or due to the plotting methods of ContourPlot itself.

enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ I would be nice to cite the author of the comment who provided this idea. $\endgroup$
    – bbgodfrey
    Commented Mar 28, 2023 at 3:53
  • $\begingroup$ @bbgodfrey Thanks for reminding me. $\endgroup$
    – Link
    Commented Mar 28, 2023 at 4:00
  • 2
    $\begingroup$ Rather than using very large values of PlotPoints, a smaller increase in PlotPoints can be used by also specifying a value for MaxRecursion (e.g., MaxRecursion -> 5). This is often more efficient. However, without sufficient code to reproduce your results we can only guess at what might be best. $\endgroup$
    – Bob Hanlon
    Commented Mar 28, 2023 at 4:11

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.