I got curious and looked for the grid command in matplotlib/axes.py.  
Looks like an inherited-from-Matlab thing. In the cla (clear axis)  
function of the Axes class:

         self._gridOn = rcParams['axes.grid']
         #...
         self.grid(self._gridOn)

and grid() passes its argument on to the xaxis.grid and yaxis.grid.

I haven't found the code that checks any of those settings to decide  
whether the gridline objects are to be drawn or not (??) but I think  
we can rule out Harry Potter. Not magic: adaptation. (Or, if you will,  
not mystification: legacy code.)

&C


On May 4, 2010, at 3:27 PM, Nico Schlömer wrote:

> This is weird:
>
> When plotting something very simple, e.g.,
>
>        t = arange( 0.0, 2.0, 0.01 )
>        s = sin( 2*pi*t )
>        plot( t, s, ":" )
>
> I thought I can check weather the grid is on or off by
>
>   gca().get_xgridlines()
>
> -- but this *always* returns
>
> <a list of 5 Line2D xgridline objects>
>
> with *always* the same lines
>
> Line2D((0,0),(0,1))
> Line2D((0,0),(0,1))
> Line2D((0,0),(0,1))
> Line2D((0,0),(0,1))
> Line2D((0,0),(0,1))
>
> That's really independent of whether the grid is on or off.
>
> Is there any explanation for it that does not have to do with Harry
> Potter or the Jedi? ;)
>
> --Nico
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to