Keeping 2 identical plots #248
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Important
This PR is here to share finding based on regression with 0.24.0 but does not solve the overall issue
with idential plots.
This fixes a regression. old behavior was keeping identical plots. closes #243
This is a special case to handle, as evaluate still needs to identify plots that are really different and avoid changes of
par()
or other small changes that are not visually different.Same as with ggplot
The changes in this PR are based on comparison with old working behavior at e1ece68 and v0.24.0
Especially:
New behavior is filtering out plots with identical display list
evaluate/R/graphics.R
Lines 14 to 17 in cadec2f
and this is the case with those two identicals
Previously this checks was done only when new display list was higher length that old due to
if (n2 <= n1) return(FALSE)
evaluate/R/graphics.R
Lines 29 to 45 in a3a85ce
Lastly, the previous behavior only checked for nonvisual changes when the old and new plots were not identical. Identical recorded plots were considered duplicates to filter out, but were identical on both their display list AND their raw representation
https://github.com/cderv/evaluate/blob/a3a85ce83b9841b2924ad66d16a551cca1368533/R/graphics.R#L18-L21
And the think is: Two calls to
hist(cars$speed)
does lead to identical display list, but not identical raw.I believe the old behavior was based on this. It does seem odd...
And looking further, this only works with two plots not 3.
This is with v0.24.0 before changes
So, definitely a deeper problem.
This raises the question of whether and how evaluate should handle identical plots in the same evaluation. 🤔