hi all,
i have the following plot:
rcParams[‘xtick.direction’] = ‘out’
rcParams[‘ytick.direction’] = ‘out’
scatter(x, y)
this changes the tick directions to be out. how can i make it so only the ticks on the x axis and y axis appear? i.e. remove the ticks that are in the top axis (the one parallel to the x-axis) and in the right most axis (the one parallel to the y-axis)?
thanks.
Hi ,
The example below seems to do what you want, but I'm not sure if this is the
favourite way to do it.
Please notice: the if-statement might not be correct in any case of
application.
regards Matthias
----------------------------------------------------------------------------------------------
from matplotlib import rcParams
import matplotlib.pyplot as plt
rcParams['xtick.direction'] = 'out'
rcParams['ytick.direction'] = 'out'
fig = plt.figure()
ax = fig.add_subplot(111)
# run through all lines drawn for xticks and yticks
for i, line in enumerate(ax.get_xticklines() + ax.get_yticklines()):
if i%2 == 1: # odd indices
line.set_visible(False)
plt.show()
···
--------------------------------------------------------------------------------------
On Wednesday 04 March 2009 01:56:07 per freem wrote:
hi all,
i have the following plot:
rcParams['xtick.direction'] = 'out'
rcParams['ytick.direction'] = 'out'
scatter(x, y)
this changes the tick directions to be out. how can i make it so only the
ticks on the x axis and y axis appear? i.e. remove the ticks that are in
the top axis (the one parallel to the x-axis) and in the right most axis
(the one parallel to the y-axis)?
thanks.