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

Skip to content

Commit 0f23712

Browse files
committed
fixed pep8 formatting
1 parent 7e44f35 commit 0f23712

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

examples/ticks_and_spines/tick_labels_from_values.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Basic demo showing how to set tick labels to values of a series.
44
55
Using ax.set_xticks causes the tick labels to be set on the currently
6-
chosen ticks. However, you may want to allow matplotlib to dynamically
6+
chosen ticks. However, you may want to allow matplotlib to dynamically
77
choose the number of ticks and their spacing.
88
99
In this case may be better to determine the tick label from the value
@@ -16,27 +16,22 @@
1616
1717
"""
1818

19-
20-
2119
import matplotlib.pyplot as plt
2220
from matplotlib.ticker import FuncFormatter, MaxNLocator
23-
24-
2521
fig = plt.figure()
2622
ax = fig.add_subplot(111)
2723
xs = range(26)
2824
ys = range(26)
2925
labels = list('abcdefghijklmnopqrstuvwxyz')
3026

27+
3128
def format_fn(tick_val, tick_pos):
3229
try:
3330
return labels[int(tick_val)]
3431
except IndexError:
3532
# no label for this tick
3633
return ''
37-
3834
ax.xaxis.set_major_formatter(FuncFormatter(format_fn))
3935
ax.xaxis.set_major_locator(MaxNLocator(integer=True))
40-
4136
ax.plot(xs, ys)
4237
plt.show()

0 commit comments

Comments
 (0)