Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fixed data and mid_data_ticks
  • Loading branch information
Chilipp committed Apr 28, 2020
commit ca83935403daeaaee368103c04fbfd1b60c48d30
26 changes: 20 additions & 6 deletions psy_simple/plotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,12 @@ def array(self):
mask = np.asarray(data.notnull())
return data.values[mask]

def _data_ticks(self, step=None):
def _data_ticks(self, step=None, *args, **kwargs):
step = step or 1
"""Array of ticks that match exactly the data"""
return np.unique(self.array)[::step]

def _mid_data_ticks(self, step=None):
def _mid_data_ticks(self, step=None, *args, **kwargs):
step = step or 1
"""Array of ticks in the middle between the data points"""
arr = np.unique(self.array)
Expand All @@ -449,6 +449,21 @@ def _mid_data_ticks(self, step=None):
def _collect_array(self, percmin=None, percmax=None):
"""Collect the data from the shared formatoptions (if necessary)."""

def nanmin(arr):
try:
return np.nanmin(arr)
except TypeError:
return arr.min()

def nanmax(arr):
try:
return np.nanmax(arr)
except TypeError:
return arr.max()

def minmax(arr):
return [nanmin(arr), nanmax(arr)]

def shared_arrays():
for fmto in self.shared:
fmto._lock_children()
Expand All @@ -473,7 +488,9 @@ def shared_arrays():
[self.array], shared_arrays()))))
return arr

def _calc_vmin_vmax(self, percmin=None, percmax=None, vmin=None, vmax=None):
def _calc_vmin_vmax(self, percmin=None, percmax=None,
vmin=None, vmax=None):

def nanmin(arr):
try:
return np.nanmin(arr)
Expand All @@ -486,9 +503,6 @@ def nanmax(arr):
except TypeError:
return arr.max()

def minmax(arr):
return [nanmin(arr), nanmax(arr)]

if vmin is not None and vmax is not None:
return vmin, vmax

Expand Down