prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Demo quiver.py not working
  **Problem Description**
  Zooming in will ends with the following and blank plot.
  
  **Reproduction Steps:**
  
  Run the file and zoom in until the plot breaks.
  
  **Expected behavior:**
  
  Plot disappear if keep zooming in and ends with following trace.
  
  ```
  Traceback (most recent call last):
    File "/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/qt4/base_window.py", line 202, in paintEvent
      self.handler.paintEvent(event)
    File "/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/qt4/base_window.py", line 54, in paintEvent
      self._enable_window._paint(event)
    File "/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/abstract_window.py", line 468, in _paint
      self.component.draw(gc, view_bounds=(0, 0, size[0], size[1]))
    File "/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/component.py", line 427, in draw
      self._draw(gc, view_bounds, mode)
    File "/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/component.py", line 779, in _draw
      self._dispatch_draw(layer, gc, view_bounds, mode)
    File "/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/container.py", line 272, in _dispatch_draw
      component._dispatch_draw(layer, gc, new_bounds, mode)
    File "/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/container.py", line 272, in _dispatch_draw
      component._dispatch_draw(layer, gc, new_bounds, mode)
    File "/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/component.py", line 799, in _dispatch_draw
      handler(gc, view_bounds, mode)
    File "/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/chaco/base_xy_plot.py", line 466, in _draw_plot
      self._draw_component(gc, view_bounds, mode)
    File "/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/chaco/base_xy_plot.py", line 474, in _draw_component
      self._render(gc, pts)
    File "/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/chaco/quiverplot.py", line 80, in _render
      ends = points + self._cached_vector_data
  ValueError: operands could not be broadcast together with shapes (0,) (0,2)
  ```
  
  **OS, Python version:** 
  OSX, Python 2.7
  
  splits from #385 
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `chaco/quiverplot.py`
  Content:
  ```
  1 
  2 from __future__ import with_statement
  3 
  4 from numpy import array, compress, matrix, newaxis, sqrt, zeros
  5 
  6 # Enthought library imports
  7 from enable.api import ColorTrait
  8 from traits.api import Array, Enum, Float, Instance, Int
  9 
  10 # Chaco relative imports
  11 from .abstract_data_source import AbstractDataSource
  12 from .scatterplot import ScatterPlot
  13 
  14 class QuiverPlot(ScatterPlot):
  15 
  16     # Determines how to interpret the data in the **vectors** data source.
  17     #   "vector": each tuple is a (dx, dy)
  18     #   "radial": each tuple is an (r, theta)
  19     data_type = Enum("vector", "radial") # TODO: implement "radial"
  20 
  21     # A datasource that returns an Nx2 array array indicating directions
  22     # of the vectors.  The interpretation of this array is dependent on
  23     # the setting of the **data_type** attribute.
  24     #
  25     # Usually this will be a MultiArrayDataSource.
  26     vectors = Instance(AbstractDataSource)
  27 
  28     #------------------------------------------------------------------------
  29     # Visual attributes of the vector
  30     #------------------------------------------------------------------------
  31 
  32     # The color of the lines
  33     line_color = ColorTrait("black")
  34 
  35     # The width of the lines
  36     line_width = Float(1.0)
  37 
  38     # The length, in pixels, of the arrowhead
  39     arrow_size = Int(5)
  40 
  41     #------------------------------------------------------------------------
  42     # Private traits
  43     #------------------------------------------------------------------------
  44 
  45     _cached_vector_data = Array
  46     _selected_vector_data = Array
  47 
  48     def _gather_points_old(self):
  49         # In addition to the standard scatterplot _gather_points, we need
  50         # to also grab the vectors that fall inside the view range
  51         super(QuiverPlot, self)._gather_points_old()
  52 
  53         if not self.index or not self.value:
  54             return
  55 
  56         if len(self._cached_point_mask) == 0:
  57             self._cached_vector_data = []
  58             return
  59 
  60         vectors = self.vectors.get_data()
  61         self._cached_vector_data = compress(self._cached_point_mask, vectors, axis=0)
  62 
  63         if self._cached_selected_pts is not None:
  64             indices = self._cached_selection_point_mask
  65             self._selected_vector_data = compress(indices, vectors, axis=0)
  66         else:
  67             self._selected_vector_data = None
  68         return
  69 
  70 
  71     def _render(self, gc, points, icon_mode=False):
  72         with gc:
  73             gc.clip_to_rect(self.x, self.y, self.width, self.height)
  74 
  75             gc.set_stroke_color(self.line_color_)
  76             gc.set_line_width(self.line_width)
  77 
  78             # Draw the body of the arrow
  79             starts = points
  80             ends = points + self._cached_vector_data
  81             gc.begin_path()
  82             gc.line_set(starts, ends)
  83             gc.stroke_path()
  84 
  85             if self.arrow_size > 0:
  86                 vec = self._cached_vector_data
  87                 unit_vec = vec / sqrt(vec[:,0] ** 2 + vec[:,1] ** 2)[:, newaxis]
  88                 a = 0.707106781   # sqrt(2)/2
  89 
  90                 # Draw the left arrowhead (for an arrow pointing straight up)
  91                 arrow_ends = ends - array(unit_vec * matrix([[a, a], [-a, a]])) * self.arrow_size
  92                 gc.begin_path()
  93                 gc.line_set(ends, arrow_ends)
  94                 gc.stroke_path()
  95 
  96                 # Draw the left arrowhead (for an arrow pointing straight up)
  97                 arrow_ends = ends - array(unit_vec * matrix([[a, -a], [a, a]])) * self.arrow_size
  98                 gc.begin_path()
  99                 gc.line_set(ends, arrow_ends)
  100                 gc.stroke_path()
  101
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/chaco/quiverplot.py b/chaco/quiverplot.py
  --- a/chaco/quiverplot.py
  +++ b/chaco/quiverplot.py
  @@ -69,6 +69,9 @@
   
   
       def _render(self, gc, points, icon_mode=False):
  +        if len(points) < 1:
  +            return
  +
           with gc:
               gc.clip_to_rect(self.x, self.y, self.width, self.height)
  
verification_info: {"golden_diff": "diff --git a/chaco/quiverplot.py b/chaco/quiverplot.py\n--- a/chaco/quiverplot.py\n+++ b/chaco/quiverplot.py\n@@ -69,6 +69,9 @@\n \n \n     def _render(self, gc, points, icon_mode=False):\n+        if len(points) < 1:\n+            return\n+\n         with gc:\n             gc.clip_to_rect(self.x, self.y, self.width, self.height)\n", "issue": "Demo quiver.py not working\n**Problem Description**\r\nZooming in will ends with the following and blank plot.\r\n\r\n**Reproduction Steps:**\r\n\r\nRun the file and zoom in until the plot breaks.\r\n\r\n**Expected behavior:**\r\n\r\nPlot disappear if keep zooming in and ends with following trace.\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/qt4/base_window.py\", line 202, in paintEvent\r\n    self.handler.paintEvent(event)\r\n  File \"/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/qt4/base_window.py\", line 54, in paintEvent\r\n    self._enable_window._paint(event)\r\n  File \"/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/abstract_window.py\", line 468, in _paint\r\n    self.component.draw(gc, view_bounds=(0, 0, size[0], size[1]))\r\n  File \"/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/component.py\", line 427, in draw\r\n    self._draw(gc, view_bounds, mode)\r\n  File \"/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/component.py\", line 779, in _draw\r\n    self._dispatch_draw(layer, gc, view_bounds, mode)\r\n  File \"/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/container.py\", line 272, in _dispatch_draw\r\n    component._dispatch_draw(layer, gc, new_bounds, mode)\r\n  File \"/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/container.py\", line 272, in _dispatch_draw\r\n    component._dispatch_draw(layer, gc, new_bounds, mode)\r\n  File \"/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/enable/component.py\", line 799, in _dispatch_draw\r\n    handler(gc, view_bounds, mode)\r\n  File \"/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/chaco/base_xy_plot.py\", line 466, in _draw_plot\r\n    self._draw_component(gc, view_bounds, mode)\r\n  File \"/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/chaco/base_xy_plot.py\", line 474, in _draw_component\r\n    self._render(gc, pts)\r\n  File \"/Users/ktakami/.edm/envs/chaco-dev/lib/python2.7/site-packages/chaco/quiverplot.py\", line 80, in _render\r\n    ends = points + self._cached_vector_data\r\nValueError: operands could not be broadcast together with shapes (0,) (0,2)\r\n```\r\n\r\n**OS, Python version:** \r\nOSX, Python 2.7\r\n\r\nsplits from #385 \n", "before_files": [{"content": "\nfrom __future__ import with_statement\n\nfrom numpy import array, compress, matrix, newaxis, sqrt, zeros\n\n# Enthought library imports\nfrom enable.api import ColorTrait\nfrom traits.api import Array, Enum, Float, Instance, Int\n\n# Chaco relative imports\nfrom .abstract_data_source import AbstractDataSource\nfrom .scatterplot import ScatterPlot\n\nclass QuiverPlot(ScatterPlot):\n\n    # Determines how to interpret the data in the **vectors** data source.\n    #   \"vector\": each tuple is a (dx, dy)\n    #   \"radial\": each tuple is an (r, theta)\n    data_type = Enum(\"vector\", \"radial\") # TODO: implement \"radial\"\n\n    # A datasource that returns an Nx2 array array indicating directions\n    # of the vectors.  The interpretation of this array is dependent on\n    # the setting of the **data_type** attribute.\n    #\n    # Usually this will be a MultiArrayDataSource.\n    vectors = Instance(AbstractDataSource)\n\n    #------------------------------------------------------------------------\n    # Visual attributes of the vector\n    #------------------------------------------------------------------------\n\n    # The color of the lines\n    line_color = ColorTrait(\"black\")\n\n    # The width of the lines\n    line_width = Float(1.0)\n\n    # The length, in pixels, of the arrowhead\n    arrow_size = Int(5)\n\n    #------------------------------------------------------------------------\n    # Private traits\n    #------------------------------------------------------------------------\n\n    _cached_vector_data = Array\n    _selected_vector_data = Array\n\n    def _gather_points_old(self):\n        # In addition to the standard scatterplot _gather_points, we need\n        # to also grab the vectors that fall inside the view range\n        super(QuiverPlot, self)._gather_points_old()\n\n        if not self.index or not self.value:\n            return\n\n        if len(self._cached_point_mask) == 0:\n            self._cached_vector_data = []\n            return\n\n        vectors = self.vectors.get_data()\n        self._cached_vector_data = compress(self._cached_point_mask, vectors, axis=0)\n\n        if self._cached_selected_pts is not None:\n            indices = self._cached_selection_point_mask\n            self._selected_vector_data = compress(indices, vectors, axis=0)\n        else:\n            self._selected_vector_data = None\n        return\n\n\n    def _render(self, gc, points, icon_mode=False):\n        with gc:\n            gc.clip_to_rect(self.x, self.y, self.width, self.height)\n\n            gc.set_stroke_color(self.line_color_)\n            gc.set_line_width(self.line_width)\n\n            # Draw the body of the arrow\n            starts = points\n            ends = points + self._cached_vector_data\n            gc.begin_path()\n            gc.line_set(starts, ends)\n            gc.stroke_path()\n\n            if self.arrow_size > 0:\n                vec = self._cached_vector_data\n                unit_vec = vec / sqrt(vec[:,0] ** 2 + vec[:,1] ** 2)[:, newaxis]\n                a = 0.707106781   # sqrt(2)/2\n\n                # Draw the left arrowhead (for an arrow pointing straight up)\n                arrow_ends = ends - array(unit_vec * matrix([[a, a], [-a, a]])) * self.arrow_size\n                gc.begin_path()\n                gc.line_set(ends, arrow_ends)\n                gc.stroke_path()\n\n                # Draw the left arrowhead (for an arrow pointing straight up)\n                arrow_ends = ends - array(unit_vec * matrix([[a, -a], [a, a]])) * self.arrow_size\n                gc.begin_path()\n                gc.line_set(ends, arrow_ends)\n                gc.stroke_path()\n", "path": "chaco/quiverplot.py"}], "after_files": [{"content": "\nfrom __future__ import with_statement\n\nfrom numpy import array, compress, matrix, newaxis, sqrt, zeros\n\n# Enthought library imports\nfrom enable.api import ColorTrait\nfrom traits.api import Array, Enum, Float, Instance, Int\n\n# Chaco relative imports\nfrom .abstract_data_source import AbstractDataSource\nfrom .scatterplot import ScatterPlot\n\nclass QuiverPlot(ScatterPlot):\n\n    # Determines how to interpret the data in the **vectors** data source.\n    #   \"vector\": each tuple is a (dx, dy)\n    #   \"radial\": each tuple is an (r, theta)\n    data_type = Enum(\"vector\", \"radial\") # TODO: implement \"radial\"\n\n    # A datasource that returns an Nx2 array array indicating directions\n    # of the vectors.  The interpretation of this array is dependent on\n    # the setting of the **data_type** attribute.\n    #\n    # Usually this will be a MultiArrayDataSource.\n    vectors = Instance(AbstractDataSource)\n\n    #------------------------------------------------------------------------\n    # Visual attributes of the vector\n    #------------------------------------------------------------------------\n\n    # The color of the lines\n    line_color = ColorTrait(\"black\")\n\n    # The width of the lines\n    line_width = Float(1.0)\n\n    # The length, in pixels, of the arrowhead\n    arrow_size = Int(5)\n\n    #------------------------------------------------------------------------\n    # Private traits\n    #------------------------------------------------------------------------\n\n    _cached_vector_data = Array\n    _selected_vector_data = Array\n\n    def _gather_points_old(self):\n        # In addition to the standard scatterplot _gather_points, we need\n        # to also grab the vectors that fall inside the view range\n        super(QuiverPlot, self)._gather_points_old()\n\n        if not self.index or not self.value:\n            return\n\n        if len(self._cached_point_mask) == 0:\n            self._cached_vector_data = []\n            return\n\n        vectors = self.vectors.get_data()\n        self._cached_vector_data = compress(self._cached_point_mask, vectors, axis=0)\n\n        if self._cached_selected_pts is not None:\n            indices = self._cached_selection_point_mask\n            self._selected_vector_data = compress(indices, vectors, axis=0)\n        else:\n            self._selected_vector_data = None\n        return\n\n\n    def _render(self, gc, points, icon_mode=False):\n        if len(points) < 1:\n            return\n\n        with gc:\n            gc.clip_to_rect(self.x, self.y, self.width, self.height)\n\n            gc.set_stroke_color(self.line_color_)\n            gc.set_line_width(self.line_width)\n\n            # Draw the body of the arrow\n            starts = points\n            ends = points + self._cached_vector_data\n            gc.begin_path()\n            gc.line_set(starts, ends)\n            gc.stroke_path()\n\n            if self.arrow_size > 0:\n                vec = self._cached_vector_data\n                unit_vec = vec / sqrt(vec[:,0] ** 2 + vec[:,1] ** 2)[:, newaxis]\n                a = 0.707106781   # sqrt(2)/2\n\n                # Draw the left arrowhead (for an arrow pointing straight up)\n                arrow_ends = ends - array(unit_vec * matrix([[a, a], [-a, a]])) * self.arrow_size\n                gc.begin_path()\n                gc.line_set(ends, arrow_ends)\n                gc.stroke_path()\n\n                # Draw the left arrowhead (for an arrow pointing straight up)\n                arrow_ends = ends - array(unit_vec * matrix([[a, -a], [a, a]])) * self.arrow_size\n                gc.begin_path()\n                gc.line_set(ends, arrow_ends)\n                gc.stroke_path()\n", "path": "chaco/quiverplot.py"}]}