Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions chaco/base_1d_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Abstract base class for 1-D plots which only use one axis
"""
# Standard library imports
from numpy import argsort, asarray
from numpy import argsort, asarray, empty

# Enthought library imports
from traits.api import (
Expand Down Expand Up @@ -121,7 +121,7 @@ def map_screen(self, data_array):
"""
# data_array is 1D array of length N
if len(data_array) == 0:
return []
return empty(shape=(0,))
return asarray(self.index_mapper.map_screen(data_array))

def map_data(self, screen_pts):
Expand Down
4 changes: 2 additions & 2 deletions chaco/base_2d_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
""" Defines the base class for 2-D plots.
"""
# Standard library imports
from numpy import asarray, isnan
from numpy import asarray, empty, isnan

# Enthought library imports.
from traits.api import Enum, Event, Instance, Property, Range, Trait
Expand Down Expand Up @@ -121,7 +121,7 @@ def map_screen(self, data_pts):
"""
# data_pts is Nx2 array
if len(data_pts) == 0:
return []
return empty(shape=(0,2))
return asarray(self.index_mapper.map_screen(data_pts))

def map_data(self, screen_pts):
Expand Down
4 changes: 2 additions & 2 deletions chaco/data_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
""" Defines the DataView class, and associated property traits and property
functions.
"""
from numpy import array, transpose
from numpy import array, empty, transpose

from traits.api import Bool, Enum, Instance, Property
from enable.api import color_table
Expand Down Expand Up @@ -244,7 +244,7 @@ def map_screen(self, data_array):
"""
# data_array is Nx2 array
if len(data_array) == 0:
return []
return empty(shape=(0,2))
x_ary, y_ary = transpose(data_array)
sx = self.index_mapper.map_screen(x_ary)
sy = self.value_mapper.map_screen(y_ary)
Expand Down
2 changes: 1 addition & 1 deletion chaco/plots/jitterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def map_screen(self, data_array):
Implements the AbstractPlotRenderer interface.
"""
if len(data_array) == 0:
return np.zeros(0)
return np.empty(shape=(0,))

if self._screen_cache_valid:
sm = self._cached_screen_map
Expand Down
4 changes: 2 additions & 2 deletions chaco/plots/polar_line_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


# Major library imports
from numpy import array, cos, pi, sin, transpose
from numpy import array, cos, empty, pi, sin, transpose

# Enthought library imports
from enable.api import black_color_trait, LineStyle
Expand Down Expand Up @@ -98,7 +98,7 @@ def map_screen(self, data_array):
"""

if len(data_array) == 0:
return []
return empty(shape=(0, 2))
elif len(data_array) == 1:
xtmp, ytmp = transpose(data_array)
x_ary = xtmp
Expand Down
4 changes: 2 additions & 2 deletions examples/demo/advanced/spec_waterfall.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""
# Major library imports
import pyaudio
from numpy import zeros, linspace, short, fromstring, transpose, array
from numpy import zeros, linspace, short, fromstring, transpose, array, empty
from scipy import fft

# Enthought library imports
Expand Down Expand Up @@ -78,7 +78,7 @@ def map_screen(self, data_array, data_offset=None):
provided, then y2_mapper is used.
"""
if len(data_array) == 0:
return []
return empty(shape=(0,2))
x_ary, y_ary = transpose(data_array)
sx = self.index_mapper.map_screen(x_ary)
if data_offset is not None:
Expand Down