TutteInstitute / datamapplot

Creating beautiful plots of data maps
MIT License
449 stars 29 forks source link

labels is required and needs multiple values #12

Closed dribnet closed 4 months ago

dribnet commented 4 months ago

It seems that create_plot and create_interactive_plot both make the assumption that:

1) The plot had labels at all 2) The plot had at least two labels

I was a bit surprised that labels was a required argument since I didn't have clusters in my data and just wanted to see the data visually with the raw hover information. So as an initial workaround, I created a dummy list of labels where all data was "Unlabelled" or all data had the same label, but either caused a runtime crash.

In the end, I used these dummy labels

all_pipe = ["not_pipe", "Unlabelled"]
for n in range(len(lines)-2):
    all_pipe.append("pipe")
labels_all_pipe = np.array(all_pipe)

To work around this (and #11). But it seems like it could make sense to in the future allow unlabelled plots with simply labels=None

lmcinnes commented 4 months ago

When I started this was really about putting labels on a plot in a sensible way, and only meant static plots. This was because it was actually surprisingly hard to do right at the time. So that's why labels are a required argument. You do make a good point though -- now that there is interactive plotting, and in the case you just want to take advantage of the automated point-size/use of datashader etc. there is reason to allow for no labels. Do you have any thoughts as to the colour that should be used? Should it all be the noise_color?

lmcinnes commented 4 months ago

Should be resolved now. Between this and #11 I have decided to push a minor patch release, so that should be hitting PyPI (and eventually conda-forge) in the next little while. Hopefully that solves these problems for you. Feedback is welcome.

lmcinnes commented 4 months ago

Should be resolved now.