From: kususe <ku...@in...> - 2012-03-14 09:44:34
|
Hi folks, I have a graph got using the subplot command. I'd like to remove all ticks in X axis in all of graph. I used: plt.setp(plt.gca(),'XtickLabel',[]) but I get that: File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 1169, in setp func = getattr(o,funcName) AttributeError: 'AxesSubplot' object has no attribute 'set_xticklabel' Suggestions? Thanks in advance K -- View this message in context: http://old.nabble.com/How-to-remove-x-axis-in-a-subplotted-graph-tp33500598p33500598.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Tony Yu <ts...@gm...> - 2012-03-14 14:06:06
|
On Wed, Mar 14, 2012 at 5:44 AM, kususe <ku...@in...> wrote: > > Hi folks, > I have a graph got using the subplot command. > I'd like to remove all ticks in X axis in all of graph. > > I used: plt.setp(plt.gca(),'XtickLabel',[]) > > but I get that: > > File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 1169, in > setp > func = getattr(o,funcName) > AttributeError: 'AxesSubplot' object has no attribute 'set_xticklabel' > > Suggestions? > Thanks in advance > K > > You're missing an "s"; i.e. "xticklabels". Also, the more conventional pattern is to call the axes method, i.e.: >>> ax = plt.gca() >>> ax.set_xticklabels([]) or, if want to remove both labels and the tick-lines >>> ax.set_xticks([]) Best, -Tony |
From: kususe <ku...@in...> - 2012-03-14 17:41:49
|
Thanks, it works. But if the graph is just one in a figure. I created various graph and I wanna remove all ticks in all of X axis. I coded: plt.subplot(3,1,1) p1, = plt.plot(self.data0,self.data1) ..... plt.subplot(3,1,2) p2, = plt.plot(self.data0,self.data2) ..... plt.subplot(3,1,3) p3, = plt.plot(self.data0,self.data4) ..... how can I work the problem out? Thanks in advance K. Tony Yu-3 wrote: > > On Wed, Mar 14, 2012 at 5:44 AM, kususe <ku...@in...> wrote: > >> >> Hi folks, >> I have a graph got using the subplot command. >> I'd like to remove all ticks in X axis in all of graph. >> >> I used: plt.setp(plt.gca(),'XtickLabel',[]) >> >> but I get that: >> >> File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 1169, in >> setp >> func = getattr(o,funcName) >> AttributeError: 'AxesSubplot' object has no attribute 'set_xticklabel' >> >> Suggestions? >> Thanks in advance >> K >> >> > You're missing an "s"; i.e. "xticklabels". Also, the more conventional > pattern is to call the axes method, i.e.: > > >>> ax = plt.gca() > >>> ax.set_xticklabels([]) > > or, if want to remove both labels and the tick-lines > > >>> ax.set_xticks([]) > > Best, > -Tony > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/How-to-remove-x-axis-in-a-subplotted-graph-tp33500598p33504036.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Tony Yu <ts...@gm...> - 2012-03-14 18:15:10
|
On Wed, Mar 14, 2012 at 1:41 PM, kususe <ku...@in...> wrote: > > Thanks, it works. > But if the graph is just one in a figure. > > I created various graph and I wanna remove all ticks in all of X axis. > I coded: > > plt.subplot(3,1,1) > p1, = plt.plot(self.data0,self.data1) > ..... > plt.subplot(3,1,2) > p2, = plt.plot(self.data0,self.data2) > ..... > plt.subplot(3,1,3) > p3, = plt.plot(self.data0,self.data4) > ..... > > how can I work the problem out? > I would do the following (`subplots` requires mpl 1.0, I think): fig, axes = plt.subplots(ncols=3) ax1, ax2, ax3 = axes ax1.plot(x, y1) ... ax2.plot(x, y2) ... ax3.plot(x, y3) ... for ax in axes:\ ax.set_xticks([]) ... Cheers, -Tony Thanks in advance > K. > > > Tony Yu-3 wrote: > > > > On Wed, Mar 14, 2012 at 5:44 AM, kususe <ku...@in...> wrote: > > > >> > >> Hi folks, > >> I have a graph got using the subplot command. > >> I'd like to remove all ticks in X axis in all of graph. > >> > >> I used: plt.setp(plt.gca(),'XtickLabel',[]) > >> > >> but I get that: > >> > >> File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 1169, in > >> setp > >> func = getattr(o,funcName) > >> AttributeError: 'AxesSubplot' object has no attribute 'set_xticklabel' > >> > >> Suggestions? > >> Thanks in advance > >> K > >> > >> > > You're missing an "s"; i.e. "xticklabels". Also, the more conventional > > pattern is to call the axes method, i.e.: > > > > >>> ax = plt.gca() > > >>> ax.set_xticklabels([]) > > > > or, if want to remove both labels and the tick-lines > > > > >>> ax.set_xticks([]) > > > > Best, > > -Tony > > > > > ------------------------------------------------------------------------------ > > Virtualization & Cloud Management Using Capacity Planning > > Cloud computing makes use of virtualization - but cloud computing > > also focuses on allowing computing to be delivered as a service. > > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > -- > View this message in context: > http://old.nabble.com/How-to-remove-x-axis-in-a-subplotted-graph-tp33500598p33504036.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: kususe <ku...@in...> - 2012-03-14 18:38:36
|
I got an error using the first subplot function because I have to specify 3 parameters. If i do it, I get that "AxesSubplot' object is not iterable" I coded using 3 subplot functions, getting the same error. Thanks K. Tony Yu-3 wrote: > > On Wed, Mar 14, 2012 at 1:41 PM, kususe <ku...@in...> wrote: > >> >> Thanks, it works. >> But if the graph is just one in a figure. >> >> I created various graph and I wanna remove all ticks in all of X axis. >> I coded: >> >> plt.subplot(3,1,1) >> p1, = plt.plot(self.data0,self.data1) >> ..... >> plt.subplot(3,1,2) >> p2, = plt.plot(self.data0,self.data2) >> ..... >> plt.subplot(3,1,3) >> p3, = plt.plot(self.data0,self.data4) >> ..... >> >> how can I work the problem out? >> > > I would do the following (`subplots` requires mpl 1.0, I think): > > fig, axes = plt.subplots(ncols=3) > ax1, ax2, ax3 = axes > ax1.plot(x, y1) > ... > ax2.plot(x, y2) > ... > ax3.plot(x, y3) > ... > for ax in axes:\ > ax.set_xticks([]) > ... > > > Cheers, > -Tony > > Thanks in advance >> K. >> >> >> Tony Yu-3 wrote: >> > >> > On Wed, Mar 14, 2012 at 5:44 AM, kususe <ku...@in...> wrote: >> > >> >> >> >> Hi folks, >> >> I have a graph got using the subplot command. >> >> I'd like to remove all ticks in X axis in all of graph. >> >> >> >> I used: plt.setp(plt.gca(),'XtickLabel',[]) >> >> >> >> but I get that: >> >> >> >> File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 1169, >> in >> >> setp >> >> func = getattr(o,funcName) >> >> AttributeError: 'AxesSubplot' object has no attribute 'set_xticklabel' >> >> >> >> Suggestions? >> >> Thanks in advance >> >> K >> >> >> >> >> > You're missing an "s"; i.e. "xticklabels". Also, the more conventional >> > pattern is to call the axes method, i.e.: >> > >> > >>> ax = plt.gca() >> > >>> ax.set_xticklabels([]) >> > >> > or, if want to remove both labels and the tick-lines >> > >> > >>> ax.set_xticks([]) >> > >> > Best, >> > -Tony >> > >> > >> ------------------------------------------------------------------------------ >> > Virtualization & Cloud Management Using Capacity Planning >> > Cloud computing makes use of virtualization - but cloud computing >> > also focuses on allowing computing to be delivered as a service. >> > http://www.accelacomm.com/jaw/sfnl/114/51521223/ >> > _______________________________________________ >> > Matplotlib-users mailing list >> > Mat...@li... >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > >> > >> -- >> View this message in context: >> http://old.nabble.com/How-to-remove-x-axis-in-a-subplotted-graph-tp33500598p33504036.html >> Sent from the matplotlib - users mailing list archive at Nabble.com. >> >> >> >> ------------------------------------------------------------------------------ >> Virtualization & Cloud Management Using Capacity Planning >> Cloud computing makes use of virtualization - but cloud computing >> also focuses on allowing computing to be delivered as a service. >> http://www.accelacomm.com/jaw/sfnl/114/51521223/ >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/How-to-remove-x-axis-in-a-subplotted-graph-tp33500598p33504472.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Tony Yu <ts...@gm...> - 2012-03-14 18:45:57
|
On Wed, Mar 14, 2012 at 2:38 PM, kususe <ku...@in...> wrote: > > I got an error using the first subplot function because I have to specify 3 > parameters. > If i do it, I get that "AxesSubplot' object is not iterable" > I coded using 3 subplot functions, getting the same error. > > Thanks > K. > > Note that I wrote `subplots` with an "s", which is a different command than `subplot`. (You're really having problems with "s"s today :) BTW, would you mind interleaving or bottom-posting replies<http://en.wikipedia.org/wiki/Posting_style#Placement_of_replies>. It's a bit easier to follow the conversation that way. -Tony > > Tony Yu-3 wrote: > > > > On Wed, Mar 14, 2012 at 1:41 PM, kususe <ku...@in...> wrote: > > > >> > >> Thanks, it works. > >> But if the graph is just one in a figure. > >> > >> I created various graph and I wanna remove all ticks in all of X axis. > >> I coded: > >> > >> plt.subplot(3,1,1) > >> p1, = plt.plot(self.data0,self.data1) > >> ..... > >> plt.subplot(3,1,2) > >> p2, = plt.plot(self.data0,self.data2) > >> ..... > >> plt.subplot(3,1,3) > >> p3, = plt.plot(self.data0,self.data4) > >> ..... > >> > >> how can I work the problem out? > >> > > > > I would do the following (`subplots` requires mpl 1.0, I think): > > > > fig, axes = plt.subplots(ncols=3) > > ax1, ax2, ax3 = axes > > ax1.plot(x, y1) > > ... > > ax2.plot(x, y2) > > ... > > ax3.plot(x, y3) > > ... > > for ax in axes:\ > > ax.set_xticks([]) > > ... > > > > > > Cheers, > > -Tony > > > > Thanks in advance > >> K. > >> > >> > >> Tony Yu-3 wrote: > >> > > >> > On Wed, Mar 14, 2012 at 5:44 AM, kususe <ku...@in...> wrote: > >> > > >> >> > >> >> Hi folks, > >> >> I have a graph got using the subplot command. > >> >> I'd like to remove all ticks in X axis in all of graph. > >> >> > >> >> I used: plt.setp(plt.gca(),'XtickLabel',[]) > >> >> > >> >> but I get that: > >> >> > >> >> File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 1169, > >> in > >> >> setp > >> >> func = getattr(o,funcName) > >> >> AttributeError: 'AxesSubplot' object has no attribute > 'set_xticklabel' > >> >> > >> >> Suggestions? > >> >> Thanks in advance > >> >> K > >> >> > >> >> > >> > You're missing an "s"; i.e. "xticklabels". Also, the more conventional > >> > pattern is to call the axes method, i.e.: > >> > > >> > >>> ax = plt.gca() > >> > >>> ax.set_xticklabels([]) > >> > > >> > or, if want to remove both labels and the tick-lines > >> > > >> > >>> ax.set_xticks([]) > >> > > >> > Best, > >> > -Tony > >> > > >> > |
From: kususe <ku...@in...> - 2012-03-15 08:06:50
|
On Wed, Mar 14, 2012 at 2:38 PM, kususe <ku...@in...> wrote: > > I got an error using the first subplot function because I have to specify > 3 > parameters. > If i do it, I get that "AxesSubplot' object is not iterable" > I coded using 3 subplot functions, getting the same error. > > Thanks > K. > > Note that I wrote `subplots` with an "s", which is a different command than `subplot`. (You're really having problems with "s"s today :) BTW, would you mind interleaving or bottom-posting replies<http://en.wikipedia.org/wiki/Posting_style#Placement_of_replies>. It's a bit easier to follow the conversation that way. -Tony Yes, for sure I coded: fig, axes = plt.subplot(3,1,1) ax1, ax2, ax3 = axes p1, = ax1.plot(self.data0,self.data1) .... plt.subplot(3,1,2) p2, = ax2.plot(self.data0,self.data2) ....... plt.subplot(3,1,3) p3, = ax3.plot(self.data0,self.data4) ........ for ax in axes: ax.set_xticks([]) but I got the error which said you. -- View this message in context: http://old.nabble.com/How-to-remove-x-axis-in-a-subplotted-graph-tp33500598p33507959.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Paul H. <pmh...@gm...> - 2012-03-20 00:45:31
|
Try it like this: fig, axes = plt.subplots(3,1,1) ax1, ax2, ax3 = axes p1, = ax1.plot(self.data0,self.data1) p2, = ax2.plot(self.data0,self.data2) p3, = ax3.plot(self.data0,self.data4) for ax in axes: ax.set_xticks([]) -paul On Thu, Mar 15, 2012 at 1:06 AM, kususe <ku...@in...> wrote: > > > > On Wed, Mar 14, 2012 at 2:38 PM, kususe <ku...@in...> wrote: > >> >> I got an error using the first subplot function because I have to specify >> 3 >> parameters. >> If i do it, I get that "AxesSubplot' object is not iterable" >> I coded using 3 subplot functions, getting the same error. >> >> Thanks >> K. >> >> > Note that I wrote `subplots` with an "s", which is a different command than > `subplot`. (You're really having problems with "s"s today :) > > BTW, would you mind interleaving or bottom-posting > replies<http://en.wikipedia.org/wiki/Posting_style#Placement_of_replies>. > It's a bit easier to follow the conversation that way. > > -Tony > > > Yes, for sure I coded: > > fig, axes = plt.subplot(3,1,1) > ax1, ax2, ax3 = axes > p1, = ax1.plot(self.data0,self.data1) > .... > plt.subplot(3,1,2) > p2, = ax2.plot(self.data0,self.data2) > ....... > plt.subplot(3,1,3) > p3, = ax3.plot(self.data0,self.data4) > ........ > for ax in axes: > ax.set_xticks([]) > > but I got the error which said you. > -- > View this message in context: http://old.nabble.com/How-to-remove-x-axis-in-a-subplotted-graph-tp33500598p33507959.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Paul H. <pmh...@gm...> - 2012-03-20 00:47:04
|
Sorry...That first line should be: fig, axes = plt.subplots(ncols=3) # note: subplotS not subplot On Mon, Mar 19, 2012 at 5:45 PM, Paul Hobson <pmh...@gm...> wrote: > Try it like this: > > fig, axes = plt.subplots(3,1,1) > ax1, ax2, ax3 = axes > p1, = ax1.plot(self.data0,self.data1) > p2, = ax2.plot(self.data0,self.data2) > p3, = ax3.plot(self.data0,self.data4) > for ax in axes: > ax.set_xticks([]) > > -paul |
From: kususe <ku...@in...> - 2012-03-20 09:49:50
|
Worked out. Thanks. Paul Hobson-2 wrote: > > Sorry...That first line should be: > fig, axes = plt.subplots(ncols=3) # note: subplotS not subplot > > On Mon, Mar 19, 2012 at 5:45 PM, Paul Hobson <pmh...@gm...> wrote: >> Try it like this: >> >> fig, axes = plt.subplots(3,1,1) >> ax1, ax2, ax3 = axes >> p1, = ax1.plot(self.data0,self.data1) >> p2, = ax2.plot(self.data0,self.data2) >> p3, = ax3.plot(self.data0,self.data4) >> for ax in axes: >> ax.set_xticks([]) >> >> -paul > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/How-to-remove-x-axis-in-a-subplotted-graph-tp33500598p33537582.html Sent from the matplotlib - users mailing list archive at Nabble.com. |