Skip to content

Commit

Permalink
OWLinePlot: Simplify code for tick labels; possibly fix for non-integ…
Browse files Browse the repository at this point in the history
…er labels
  • Loading branch information
janezd committed May 17, 2019
1 parent 2635ac2 commit 99573dc
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions Orange/widgets/visualize/owlineplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,13 @@ class LinePlotStyle:
class LinePlotAxisItem(pg.AxisItem):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._ticks = None
self._ticks = {}

def set_ticks(self, ticks):
self._ticks = dict(enumerate(ticks, 1)) if ticks else None
self._ticks = dict(enumerate(ticks, 1)) if ticks else {}

def tickStrings(self, values, scale, spacing):
if not self._ticks:
return []
strings = []
for v in values:
v = v * scale
if float(v).is_integer():
strings.append(self._ticks.get(int(v), ""))
return strings
return [self._ticks.get(v * scale, "") for v in values]


class LinePlotViewBox(ViewBox):
Expand Down

0 comments on commit 99573dc

Please sign in to comment.