Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 51ec46c

Browse files
committed
fixed bug where tick labels appearing for negative values
1 parent 0f23712 commit 51ec46c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

examples/ticks_and_spines/tick_labels_from_values.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@
2626

2727

2828
def format_fn(tick_val, tick_pos):
29-
try:
29+
if int(tick_val) in xs:
3030
return labels[int(tick_val)]
31-
except IndexError:
32-
# no label for this tick
31+
else:
3332
return ''
3433
ax.xaxis.set_major_formatter(FuncFormatter(format_fn))
3534
ax.xaxis.set_major_locator(MaxNLocator(integer=True))

0 commit comments

Comments
 (0)