Skip to content

Use max_recursion 0 in _Plot. - #1523

Merged
rocky merged 3 commits into
masterfrom
adjust-max_recursion-in_PlotOptions
Nov 17, 2025
Merged

rocky merged 3 commits into
masterfrom
adjust-max_recursion-in_PlotOptions

Conversation

@rocky

@rocky rocky commented Nov 17, 2025 •

Copy link
Copy Markdown
Member

Recent discussion suggests that the default for max_recursion in plotting functions should be 0 for faster performance and better rendering.

Also, use Symbols over character strings more often in Plot options routines. (There is probably more that could be done here, but that's for some other time.)

Also use Symbols over character strings more often in Plot options routines.
@rocky
rocky requested review from bdlucas1 and mmatera November 17, 2025 02:01
Not sure why mypy tuple is okay here but Optional[tuple] is not.
some return paths return None
@bdlucas1

Copy link
Copy Markdown
Collaborator

Recent discussion suggests that the default for max_recursion in plotting functions should be 0 for faster performance and better rendering.

The better rendering in that case was achieved by turning off recursion, yes, but also increasing the number of points to compensate, but this PR doesn't change that, does it? So this will certainly improve performance, but will decrease quality. I'm not sure what value to set the number of points at to get equivalent quality, and what the comparative performance would be.

The tradeoff may also be different for this case, Plot, because I think recursive subdivision in Plot3D is probably a lot harder (guessing a bit because I haven't looked at the code for Plot, only for Plot3D).

In general, in my experiments I didn't find the performance of Plot as it stands to be problematic - Manipulate was able to get interactive performance from the current implementation of Plot. I've been focusing on Plot3D because it's a whole different story - you need a lot more data points to get a satisfactory rendering.

@rocky

rocky commented Nov 17, 2025

Copy link
Copy Markdown
Member Author

Recent discussion suggests that the default for max_recursion in plotting functions should be 0 for faster performance and better rendering.

The better rendering in that case was achieved by turning off recursion, yes, but also increasing the number of points to compensate, but this PR doesn't change that, does it? So this will certainly improve performance, but will decrease quality. I'm not sure what value to set the number of points at to get equivalent quality, and what the comparative performance would be.

The tradeoff may also be different for this case, Plot, because I think recursive subdivision in Plot3D is probably a lot harder (guessing a bit because I haven't looked at the code for Plot, only for Plot3D).

In general, in my experiments I didn't find the performance of Plot as it stands to be problematic - Manipulate was able to get interactive performance from the current implementation of Plot. I've been focusing on Plot3D because it's a whole different story - you need a lot more data points to get a satisfactory rendering.

Ok. Thanks for the clarification and additional detail. I've changed the default value back to 3 and tried to capture the wisdom here. However, if I got this wrong, please suggest alternate comments.

So what remains are just the String to Symbol changes.

@bdlucas1

Copy link
Copy Markdown
Collaborator

Comment looks good, and the other code improvements are worthwhile. LGTM.

@mmatera mmatera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rocky
rocky merged commit b1a4bff into master Nov 17, 2025
13 checks passed
@rocky
rocky deleted the adjust-max_recursion-in_PlotOptions branch November 17, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants