brisvag / blik

Python tool for visualising and interacting with cryo-ET and subtomogram averaging data.
https://brisvag.github.io/blik/
GNU General Public License v3.0
23 stars 8 forks source link

colouring points by data attribute #165

Closed McHaillet closed 1 week ago

McHaillet commented 4 months ago

I think it could be a useful feature to give the points layer a color gradient depending on a data attribute. For example, my template matching package writes out the correlation score (LCCmax) and it would be very useful to colour the points by this data attribute. Or in 3D viewing it could be useful to colour points by the z-coordinate.

From the Napari docs, it seems something like that is possible. Do you think this would be dificult to implement?

brisvag commented 4 months ago

This doesn't need anything custom, you can do it already with pure napari, as explained in that link. For example, you can do:

points_layer.face_color = 'LCCmax'  # assuming `LCCmax` is the column name
points_layer.face_colormap = 'viridis'

Or were you looking for some widget alternative?

McHaillet commented 3 months ago

Or were you looking for some widget alternative?

Yes, I meant a widget! Is that in the scope of Blik?

Once I have some more time, I could also try to make a PR for it

brisvag commented 3 months ago

I'm not sure this is in the scope for blik, but if you'd like to take a crack at a PR we can see if it's small/self-contained enough that it's a useful addition :)

In principle, it's a very general (and useful) tool for the whole napari ecosystem though, so maybe it would be good to have in napari core, maybe as part of the layer controls.

alisterburt commented 3 months ago

+1 on napari core for this, would be great if blik then loaded properties in and user automatically had the option to colour by them :)