make_dataset_pickable

Maps.make_dataset_pickable()

Make the associated dataset pickable without plotting it first.

After executing this function, m.cb.pick callbacks can be attached to the Maps object.

Note

This function is ONLY necessary if you want to use pick-callbacks without actually plotting the data**! Otherwise a call to m.plot_map() is sufficient!

  • Each Maps object can always have only one pickable dataset.

  • The used data is always the dataset that was assigned in the last call to m.plot_map() or m.make_dataset_pickable().

  • To get multiple pickable datasets, use an individual layer for each of the datasets (e.g. first m2 = m.new_layer() and then assign the data to m2)

Examples

>>> m = Maps()
>>> m.add_feature.preset.coastline()
>>> ...
>>> # a dataset that should be pickable but NOT visible...
>>> m2 = m.new_layer()
    >>> m2.set_data(*np.linspace([0, -180,-90,], [100, 180, 90], 100).T)
>>> m2.make_dataset_pickable()
>>> m2.cb.pick.attach.annotate()  # get an annotation for the invisible dataset
>>> # ...call m2.plot_map() to make the dataset visible...