You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Artifact" when plotting labels with outline=True #252
sorry for the late response! I think the "shade" you're seeing is some improperly transformed data layer, probably a difference in scale?
Could you try to reproduce your error with the code from #323? I've included several fixes to render_labels there, amongst which I also changed the outline logic to be purely based on outline_alpha since 0/1 there would be equivalent to outline = True/False
Hi @timtreis! I'm happy to report that I don't observe the artifact anymore with the current main.
It also appears to fix the other observations I had over at #253, except for the use case of plotting labels without alpha at all (render_labels(outline_alpha=1.0, fill_alpha=1.0)), but I see you're already fixing that elsewhere, so I believe both this issue, as well as my PR (and possibly the other issue I linked in the PR) can be closed! 🎉
happy to hear that the issue is already partially solved!
Could you elaborate on
except for the use case of plotting labels without alpha at all (render_labels(outline_alpha=1.0, fill_alpha=1.0)
With the current code, this would be equivalent to render_labels(fill_alpha=1.0) since any border would only ever be inside the label anyway. I just found that out like a minute ago, but here's the comment I added for clarification:
hmm, that's a fair point! I suppose it depends on what we think the zorder of a labels' fill and outline should be. AFAIK, in a matplotlib scatterplot for example, the outline of a marker is drawn on top of the fill, so in a case without any transparency, I would expect to still see the outline on top of the fill, even if it's fully contained within the label.
This would be the output if we don't just skip the outline when the alphas are the same. Because they're overlayed, they add up, in this case to fully opaque. Would you use it to for example generate a plot like this where the borders are darker but still not opaque?
Interesting! To be honest, the main use case I'm envisioning is if I was coloring the labels based on some continuous variable and didn't want to use transparency (maybe to increase contrast), but still would like the individual labels to be distinguishable by adding an outline, similar to the fourth image in the PR I linked above, or something like this.
But I can see that allowing this opens potential cans of worms, especially in combination with contour_px, and I suppose one could still force a similar behaviour with something like render_labels(outline_alpha=1.0, fill_alpha=.99)...
Activity
timtreis commentedon Aug 26, 2024
Hey @clwgg,
sorry for the late response! I think the "shade" you're seeing is some improperly transformed data layer, probably a difference in scale?
Could you try to reproduce your error with the code from #323? I've included several fixes to
render_labelsthere, amongst which I also changed the outline logic to be purely based onoutline_alphasince 0/1 there would be equivalent tooutline = True/Falseclwgg commentedon Aug 28, 2024
Hi @timtreis! I'm happy to report that I don't observe the artifact anymore with the current
main.It also appears to fix the other observations I had over at #253, except for the use case of plotting labels without alpha at all (
render_labels(outline_alpha=1.0, fill_alpha=1.0)), but I see you're already fixing that elsewhere, so I believe both this issue, as well as my PR (and possibly the other issue I linked in the PR) can be closed! 🎉timtreis commentedon Aug 28, 2024
Hey @clwgg,
happy to hear that the issue is already partially solved!
Could you elaborate on
With the current code, this would be equivalent to

render_labels(fill_alpha=1.0)since any border would only ever be inside the label anyway. I just found that out like a minute ago, but here's the comment I added for clarification:clwgg commentedon Aug 28, 2024
hmm, that's a fair point! I suppose it depends on what we think the zorder of a labels' fill and outline should be. AFAIK, in a matplotlib scatterplot for example, the outline of a marker is drawn on top of the fill, so in a case without any transparency, I would expect to still see the outline on top of the fill, even if it's fully contained within the label.
timtreis commentedon Aug 28, 2024
This would be the output if we don't just skip the outline when the alphas are the same. Because they're overlayed, they add up, in this case to fully opaque. Would you use it to for example generate a plot like this where the borders are darker but still not opaque?

timtreis commentedon Aug 28, 2024
Without any alpha you theoretically still see the border but I think that's just an artifact from the resolution of the plot.
clwgg commentedon Aug 28, 2024
Interesting! To be honest, the main use case I'm envisioning is if I was coloring the labels based on some continuous variable and didn't want to use transparency (maybe to increase contrast), but still would like the individual labels to be distinguishable by adding an outline, similar to the fourth image in the PR I linked above, or something like
this.
But I can see that allowing this opens potential cans of worms, especially in combination with
contour_px, and I suppose one could still force a similar behaviour with something likerender_labels(outline_alpha=1.0, fill_alpha=.99)...timtreis commentedon Aug 29, 2024
You could theoretically just call
render_labelstwice to enable that usecase:clwgg commentedon Aug 29, 2024
good point, thanks! 👍
timtreis commentedon Aug 29, 2024
Seems to be solved :) Thanks @clwgg !