Skip to content

Datashader shapes outlines and fill_alpha documentation #367

Open
@Sonja-Stockhaus

Description

@Sonja-Stockhaus

Status after #309, just to document some thoughts/details about the comparison between ds and mpl:

  1. outlines linewidth with datashader seems to vary slightly between e.g. polygons and circles, which is not the case with matplotlib
  2. below you see that the outlines of the circles are slightly cut in places where the extent of circles ends, but is later on expanded because of the polygons. This is similar to what we see with points. It should only be a problem with large linewidth values though.
  3. fill_alpha in ds looks lighter than in mpl, even though it's 0.5 both times. Reason: in ds, the fill_alpha is applied two times: once during the shade() step, to make sure elements are blended with each other. Then also during the rendering of the resulting image, to make sure other things that were plotted before still shine through. Possible fix: use sqrt(fill_alpha) both times. Problem: if sth else is rendered below, it would be obvious that the elements are less transparent than the user would expect (e.g. 0.7 instead of 0.5). That could be confusing.
import spatialdata_plot
from spatialdata.datasets import blobs
blob=blobs()

blob.pl.render_shapes(method="datashader", fill_alpha=0.5, outline_alpha=0.7, color="red", outline_color="blue", outline_width=5).pl.show()

blob.pl.render_shapes(method="matplotlib", fill_alpha=0.5, outline_alpha=0.7, color="red", outline_color="blue", outline_width=5).pl.show()

grafik

grafik

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions