Can anyone help me to figure out how to get tick colors
> to be anything other than black?
> I am trying to produce a plot with a gray background
> and red axes and tick lines. My code to do this is as
> follows:
> plot1 = subplot(111,axisbg='#444444')
> plot1.plot(xarr,y1arr,'bo',xarr,y2arr,'r^',xarr,y3arr,'gs')
> set(plot1.get_xticklabels(), 'color', 'r', fontsize=18)
> set(plot1.get_yticklabels(), 'color', 'r', fontsize=18)
> set(plot1.get_ygridlines(), 'color', 'w', linewidth=2)
> set(plot1.get_xgridlines(),visible=False)
> set(plot1.get_yticklines(),color='r', linewidth=2)
> xlabel('r (Kilometers)',color='y',fontsize=20)
> ylabel('Luminosity (foes/s)',color='y',fontsize=20)
> I have tried numerous tricks to get the ticklines to be
> anything other than black with no success. Any help
> would be greatly appreciated.
You have the right approach, but there is a subtly that is tripping
you up. It took me a good 5 minutes to figure out why your approach
wasn't working. matplotlib.lines.Line2D objects can have both a
linestyle and a marker. Hence the command
plot(x, y, '-o', color='red', mfc='blue', mec='g')
creates a *single* Line2D object which renders as a solid red line
with the x,y vertices marked by circles with a blue markerfacecolor
and a green markeredgecolor (mfc and mec are aliases)
The trick you are missing is that the tick lines are *markers* (their
marker symbols are an enum in matplotlib.lines: TICKLEFT, TICKRIGHT,
TICKUP, TICKDOWN).
To set the color or tick markers, you need to set the markeredgecolor
property
setp(ax.get_xticklines() + ax.get_yticklines() , mec='red')
A bit non-intuitive, admittedly, but it does work.
JDH