Text of discourse.matplotlib.org › t › grid-problem › 16427 as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout.

Open the live page

Grid problem? - matplotlib-users - Matplotlib

Grid problem? Community matplotlib-users David_Perlman January 6, 2012, 10:57pm 1 When I try to turn on the grid for just one axis, seemingly in perfect accordance with the documentation at http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.grid it seems like there is a problem. My commands are pasted below. Am I doing this wrong? I am doing the best I can to follow the documentation exactly. Thanks for any help! import matplotlib matplotlib.use('MacOSX') import matplotlib.pyplot as plt fig=plt.figure() ax=fig.add_subplot(111) ax.plot([1,2,3]) ax.set_xlabel('Hi there') ax.grid(True, axis='x') bombayduck:~$ python Python 2.6.5 (r265:79359, Mar 24 2010, 01:32:55) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information. import matplotlib matplotlib.use('MacOSX') import matplotlib.pyplot as plt fig=plt.figure() ax=fig.add_subplot(111) ax.plot([1,2,3]) [<matplotlib.lines.Line2D object at 0x1a27e30>] ax.set_xlabel('Hi there') <matplotlib.text.Text object at 0x1a58030> ax.grid(True, axis='x') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py", line 1823, in grid self.xaxis.grid(b, **kwargs) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 965, in grid if len(kwargs): artist.setp(tick.gridline,**kwargs) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 1169, in setp func = getattr(o,funcName) AttributeError: 'Line2D' object has no attribute 'set_axis' -dave---------------------------------------------------------------------- A neuroscientist is at the video arcade, when someone makes him a $1000 bet on Pac-Man.

He smiles, gets out his screwdriver and takes apart the Pac-Man game. Everyone says "What are you doing?" The neuroscientist says "Well, since we all know that Pac-Man is based on electric signals traveling through these circuits, obviously I can understand it better than the other guy by going straight to the source!" Paul_Ivanov3 January 19, 2012, 5:44am 2 Hi David, David Perlman, on 2012-01-06 16:57, wrote: Am I doing this wrong?

I am doing the best I can to follow the documentation exactly. It doesn't look like you're doing it wrong - and your example works for me, though I'm not running OS X and can't verify that it works as it should on your chosen backend. Can anyone else who has OS X verify David's error? David, it'd be useful to know what your matplotlib.__version__ is, as well as whether or not the error occurs on the latest version, if that's possible. best, ··· -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 Tony_S_Yu3 January 19, 2012, 2:58pm 3 It seems to be version-specific.

Works on my system (github HEAD). -Tony ··· On Thu, Jan 19, 2012 at 12:44 AM, Paul Ivanov <pivanov314@…287…> wrote: Hi David, David Perlman, on 2012-01-06 16:57, wrote: Am I doing this wrong? I am doing the best I can to follow the documentation exactly. It doesn’t look like you’re doing it wrong - and your example works for me, though I’m not running OS X and can’t verify that it works as it should on your chosen backend.

Can anyone else who has OS X verify David’s error? David, it’d be useful to know what your matplotlib. version is, as well as whether or not the error occurs on the latest version, if that’s possible. best, – Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7