napari-matplotlib icon indicating copy to clipboard operation
napari-matplotlib copied to clipboard

FeaturesLineWidget

Open zoccoler opened this issue 2 years ago • 3 comments

Hi @dstansby ,

As suggested in #184 , I am transferring the code here without the LineWidget.

This PR brings a BaseLineWidget and a FeaturesLineWidget to napari-matplotlib, where the FeaturesLineWidget has an object-id field capable of grouping objects before plotting, thus displaying individual line plots for each object.

Best, Marcelo

zoccoler avatar Jul 29 '23 08:07 zoccoler

Just having a play around with this, and I'm confused by what the "object-id" selector is for? Why are there not just two selectors that select what is being plotted on the x/y axes?

Good question. So the object_id is the factor that groups elements from the table using the .groupby from pandas. This allows individual lines for each label with different colors. Typically this is just a column named 'label' in the table containing the label numbers, but as this can vary from different people and I cannot anticipate what it will be, so I chose to add it in the interface and let the user decide.

By the way, I noticed I was still calling 'label' in other places, so I renamed them to object_id now to make it more general.

And following on from that, how is this different from the FeaturesScatterWidget? Could we add the functionality desired by just doing exactly the same as FeaturesScatterWidget, but joining the scatter points with a line?

Hmm I am not sure. Over there, the .scatter is being used, which returns a PathCollection right? I am interested in having access to Line2D objects. That also why I was adding a _lines list as a property of the class before, to store current Line2D artists in the plot, because I thought it would be faster to update existing lines data with .set_xdata and .set_ydata than redraw all the lines.

zoccoler avatar Aug 01 '23 10:08 zoccoler

Hi @dstansby ,

Did you have some time to consider this feature?

Thanks for your time on reviewing this!

zoccoler avatar Sep 16 '23 21:09 zoccoler

This would close #60

zoccoler avatar Oct 25 '23 06:10 zoccoler