-
-
Notifications
You must be signed in to change notification settings - Fork 361
Description
Open markers are often recommended because they are more robust against overplotting than filled markers. Currently, all our default markers such as :circle, :rect, etc. are filled. Of course we can make any marker open by only stroking it and not filling it, via strokecolor = :black, strokewidth = something_nonzero, color = :transparent.
But this is often not very convenient when you want to expose a plotting function to a user and they are supposed to be able to switch between open and closed markers. For example, in AlgebraOfGraphics, if you set up a mapping(color = ...) then just to get open markers, you would have to switch that to mapping(strokecolor = ...). This is possible in recent AoG versions, but it would again require quite a bit of internal bookkeeping in order to facilitate easy open/closed switching for a user.
I was just in the process of implementing a solution for this by adding a transformation function for BezierPath markers, in order to add a reversed downscaled version which effectively cuts a hole. I thought this might be a convenient way to turn closed into open markers. However, while this works for circles, rects and triangles, other shapes look pretty bad with this approach:
Because we do in effect want a stroke, and cutting a downsized hole is not equivalent to that.
The other drawback of this technique is that, again because we're not using a stroke, the thickness of an open marker depends on the markersize.
So I've finally reached the conclusion that maybe there should be a simple option to treat any scatter plot as "stroke only" which would use color in place of strokecolor and don't fill in markers. We would still use strokewidth to determine stroke size, which would have a nice and even behavior when scaling markers up and down.
I see two options, either make this dispatch-dependent by adding let's say an Open type, so Open(:circle) would have this effect. Or maybe a keyword option like scatter(...; open = true). The drawback of the latter is obviously that all forwarding recipes need to add that option for forwarding if they validate their keywords.
cc'ing people that were interested in open markers: @devmotion @pkofod @aplavin