I ended up finding a solution to this by using a FixedLocator and
manually setting each of the tick
positions for both major and minor grids without overlap.
I'm not sure if this is the recommended way to do this, but hey, it worked ;-)
for tick in range(seconds+1)[1:]:
if tick % major_multiple == 0:
xmajorticks.append(tick)
elif tick % minor_multiple == 0:
xminorticks.append(tick)
ax.xaxis.set_major_locator(FixedLocator(xmajorticks))
ax.xaxis.set_minor_locator(FixedLocator(xminorticks))
At 15:14 14.3.2007, Peter Buschman wrote:
Hello:
I am trying to set different colors for both major and minor
gridlines. In essence, I want the major gridlines
to be slightly darker than the minor ones.
However, using the syntax below, I can only seem to set the
properties of one of the sets of gridlines at a
time. If I comment out the ax.xaxis.grid() call for the minor grid,
the major grid color gets set correctly.
However, if I try to set both, as shown below, only the color for the
minor grid is set.
Is the minor grid overriding the major grid somehow? If so, is there
another property I need to set somewhere?
Many thanks if anyone can help :-)
minor_grid_color = '#E6E6E6'
major_grid_color = '#DCDCDC'
figure(figsize=(pagewidth, pageheight), frameon=frameon,
facecolor=facecolor, edgecolor=edgecolor)
minor_multiple = 900
major_multiple = 3600
axes([0.05, 0.05, 0.90, 0.90])
ax=gca()
ax.xaxis.set_minor_locator(MultipleLocator(minor_multiple))
ax.xaxis.set_major_locator(MultipleLocator(major_multiple))
ax.xaxis.grid(True, which="major", linestyle='-',
color=major_grid_color)
ax.xaxis.grid(True, which="minor", linestyle='-',
color=minor_grid_color)
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users