Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which is the truth: datashader VS matplotlib #399

Open
sunshx-bioinfo opened this issue Dec 25, 2024 · 1 comment
Open

Which is the truth: datashader VS matplotlib #399

sunshx-bioinfo opened this issue Dec 25, 2024 · 1 comment

Comments

@sunshx-bioinfo
Copy link

Hi,

I plot the cell boundaries with method='datashader' and method='matplotlib', they both display the cell distribution without overlapping (total 13899 cells).

But the datashader plot seems more sparse than matplotlib plot (bellow):
Image

I guess matplotlib plot is the truth, is it right? matplotlib method seems already resolves the problem of cell overlapping.

Though datashader method is faster than matplotlib mehtod, we should choose matplotlib method for more accuracy, is that right?

Looking forward to your reply.

@LucaMarconato
Copy link
Member

Hi, thanks for reaching out. You could try increasing the size of the datashader canvas, which can be influenced by increasing the figure size or the DPIs (

def _get_extent_and_range_for_datashader_canvas(
spatial_element: SpatialElement, coordinate_system: str, ax: Axes, fig_params: FigParams
).

In this case (not too many cells and not overlapping cells), I would prefer the plot on the right. You could get a more similar plot by using a bigger canvas for datashader. With a right size you may be able to get a plot with better resolved cell boundaries and still faster than matplotlib (keep in mind that the higher the canvas size the slower datashader will be).

Instead, in the case of plotting a large number of cells (so dense you can't see the boundary like here), or when plotting overlapping cells or overlapping points, the two plots would be different and datashader would be preferred (see examples such cases here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants