line_inspector is very slow
- Dominant language
- Python
- Stars
- 305
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
when run the following code, we will find that the cross line is slower than the mouse move, the
more quicker the mouse move , this will more slower!
and when modify these:
numpoints = 10000
low = 0
high = 10000
will become better
## code
```
from numpy import arange, fabs, pi, sin
from scipy.special import jn
from enable.example_support import DemoFrame, demo_main
from enable.api import Window, Component, ComponentEditor
from traits.api import HasTraits, Instance, false
from traitsui.api import Item, Group, View
from chaco.api import HPlotContainer, ArrayPlotData, Plot
from chaco.tools.api import LineInspector, ZoomTool, PanTool
def _create_plot_component():
numpoints = 100000
low = 0
high = 100000
x = arange(low, high, (high-low)/numpoints)
plotdata = ArrayPlotData(x=x, y1=jn(0,x), y2=jn(1,x))
left_plot = Plot(plotdata)
left_plot.x_axis.title = "X"
left_plot.y_axis.title = "j0(x)"
renderer = left_plot.plot(("x", "y1"), type="line", color="blue", width=2.0)[0]
renderer.overlays.append(LineInspector(renderer, axis='value',
write_metadata=True,
is_listener=True,
inspect_mode='space'))
renderer.overlays.append(LineInspector(renderer, axis="index",
write_metadata=True,
is_listener=True,
inspect_mode='space'))
left_plot.overlays.append(ZoomTool(left_plot, tool_mode="range"))
left_plot.tools.append(PanTool(left_plot))
container = HPlotContainer(background="lightgray")
container.add(left_plot)
return container
size=(750,500)
title="Two Plots"
class Demo(HasTraits):
plot = Instance(Component)
traits_view = View(
Group(
Item('plot', editor=ComponentEditor(size=size),
show_label=False),
orientation = "vertical"),
resizable=True, title=title,
width=size[0], height=size[1]
)
def _plot_default(self):
return _create_plot_component()
demo = Demo()
class PlotFrame(DemoFrame):
def _create_window(self):
return Window(self, -1, component=_create_plot_component())
if __name__ == "__main__":
demo_main(PlotFrame, size=size, title=title)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.