Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip patches not seen #262

Merged
merged 2 commits into from
Apr 13, 2020
Merged

Conversation

rjleveque
Copy link
Member

When looping over patches this version skips a patch if it has no intersection with the region specified by plotaxes.xlimits and plotaxes.ylimits. This speeds up plotting substantially for some problems, if you want to zoom in on different regions in different plots and have thousands of patches that can be ignored in each case. This is distinct from what's proposed in #246 but useful in some contexts.

Note a possible problem is that if a user creates a figure with specified xlimits and ylimits but then gives additional xlim, ylim, or axis commands to zoom out, then some patches will not be seen that should be seen in the wider view, which could be misleading or confusing. I'm ok with this but others may differ.

Turned off for now.  Note that if user zooms out with xlim or ylim command
then some patches aren't seen that should be there.
@mandli
Copy link
Member

mandli commented Apr 13, 2020

This is great!

@mandli mandli merged commit b8d8598 into clawpack:master Apr 13, 2020
@mjberger
Copy link

mjberger commented Apr 13, 2020 via email

@mandli
Copy link
Member

mandli commented Apr 13, 2020

I am not sure this would make sense for interactive plotting given that a user could move the view into the plot but the xlimits and ylimits would not change. That may be something to add (check for interactive plotting). This should work fine for batch plotting.

@rjleveque
Copy link
Member Author

Yes, it should work fine for batch processing, also in parallel.

When zooming out on a plot there's no easy way to recognize that and now plot the missing patches. So the use case I had in mind was where the appropriate xlimits and ylimits are set in setplot.py for each PlotAxes object, and if you want multiple views at different zooms the user would have to set up multiple plot figures in setplot.py. And note that if you are doing batch processing, i.e. using make plots to make the html pages rather than Iplotclaw for interactive plotting, then there is no way to zoom out other than specifying another figure, so this approach is ideal for batch processing to avoid spending time plotting patches not visible. (Though what is suggested in #246 could be even faster in some contexts.)

For exploratory interactive work using Iplotclaw it is sometimes convenient to be able to zoom out and see all the patches. So maybe this should be modified to somehow allow the user to specify this. For example, we could add a new attribute to ClawPlotAxes so that the user could specify (in setplot),

    plotaxes.plot_all_patches = True

to revert to the old behavior, whereas by default this attribute would be False and so existing setplot files would lead to the new behavior. Or maybe a better name would be plot_patches_outside_extent or something else.

What do you think?

@mjberger
Copy link

mjberger commented Apr 13, 2020 via email

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