The reason I want to disable point adding and moving functions is that I don’t need to add or move any of them. After showing dozens of points, I want to check the reliability of those points based on some experiences. Then select and delete those outliers. But sometimes points will be accidentally added or moved by wrong clicking.
If they can’t be disabled, are there any new ways to use?
Hi @ichxw
Set the add
and drag
arguments to the PointDrawTool()
constructor to False
.
The arguments are documented in the bokeh reference document; see the PointDrawTool class section. The relevant properties are not listed in the user’s documentConfiguring Plot Tools section.
Here’s a simple illustrative example.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
import numpy as np
from bokeh.models import ColumnDataSource
from bokeh.models.tools import PointDrawTool
from bokeh.plotting import figure
from bokeh.io import show
data = dict(x=np.random.randn(12), y=np.random.randn(12))
source = ColumnDataSource(data)
p = figure(width=500, height=500)
r = p.circle(x='x', y='y', source=source, size=30)
_tool = PointDrawTool(renderers=[r], add=False, drag=False)
p.add_tools(_tool)
p.toolbar.active_tap = _tool
show(p)
Great, many thanks @_jm . That’s exactly what I needed. Another rookie question, if one point got deleted, but I want to undo the deletion. Will UndoTool do the work?
The UndoTool
does not know anything about the actions that the edit tools perform. Maintaining a history of data changes would be, in general, prohibitively expensive to do.
Thanks for the information.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.