Closed kendonB closed 5 years ago
It would not be easy to change the default, but we could make this an additional option.
@clauswilke, @paleolimbot do you have any thoughts about this as part of a bigger density/contouring reconsideration?
If we implement a geom that does the contouring at draw time, then the underlying data grid can be created by a variety of different stats, and one could be a 2d loess. I think that separately we need to retain the current stat_contour()
, and probably also add a stat_filled_contour()
. I'm not sure we want to add the 2d loess option to those stats, since it makes for a busy and complicated API.
Ok, this sounds like it would best belong in an extension package then.
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/
The current implementation uses
kde2d
which has edge effects for points within the bandwidth of an edge. I believe a 2d loess wouldn't have such a problem. I believe one can calculate the loess using something likeloess(z ~ x + y)
.To illustrate the edge effects:
Top plot here is visually correct; bottom one is incorrect (see left part of the plots).
Created on 2018-08-26 by the reprex package (v0.2.0.9000).