Skip to content

Commit bd9c410

Browse files
author
Mofan Zhou
committed
matplotlib update
1 parent 4ae703d commit bd9c410

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

matplotlibTUT/plt5_ax_setting1.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
plt.ylabel('I am y')
3030

3131
# set new sticks
32-
new_sticks = np.linspace(-1, 2, 5)
33-
print(new_sticks)
34-
plt.xticks(new_sticks)
32+
new_ticks = np.linspace(-1, 2, 5)
33+
print(new_ticks)
34+
plt.xticks(new_ticks)
3535
# set tick labels
3636
plt.yticks([-2, -1.8, -1, 1.22, 3],
3737
[r'$really\ bad$', r'$bad$', r'$normal$', r'$good$', r'$really\ good$'])

matplotlibTUT/plt6_ax_setting2.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,23 @@
2626
plt.xlim((-1, 2))
2727
plt.ylim((-2, 3))
2828

29-
# set new sticks
30-
new_sticks = np.linspace(-1, 2, 5)
31-
plt.xticks(new_sticks)
29+
# set new ticks
30+
new_ticks = np.linspace(-1, 2, 5)
31+
plt.xticks(new_ticks)
3232
# set tick labels
3333
plt.yticks([-2, -1.8, -1, 1.22, 3],
34-
['$really\ bad$', 'bad', 'normal', '$good$', '$really\ good$'])
34+
['$really\ bad$', '$bad$', '$normal$', '$good$', '$really\ good$'])
3535
# to use '$ $' for math text and nice looking, e.g. '$\pi$'
3636

3737
# gca = 'get current axis'
3838
ax = plt.gca()
3939
ax.spines['right'].set_color('none')
4040
ax.spines['top'].set_color('none')
41-
ax.spines['top'].set_color('none')
4241

4342
ax.xaxis.set_ticks_position('bottom')
4443
# ACCEPTS: [ 'top' | 'bottom' | 'both' | 'default' | 'none' ]
4544

46-
ax.spines['bottom'].set_position(('data', -1))
45+
ax.spines['bottom'].set_position(('data', 0))
4746
# the 1st is in 'outward' | 'axes' | 'data'
4847
# axes: percentage of y axis
4948
# data: depend on y data

0 commit comments

Comments
 (0)