[Matplotlib-users] subplots with the OO interface (ax.rowNum, ax.colNum)
I have a figure with 2 subplots (2 rows, 1 column) created using the OO interface like this: ax1=fig.add_subplot(2,1,1) ax2=fig.add_subplot(2,1,2) After I have created these axes and plotted things on them, I want to be able to set their x and y lims. The function that creates the plot returns fig. I can then get to a list of the axes from fig.axes. My question is this: can I know from the list of axes or their individual properties which one is which - i.e. which one is the top one and which one is the bottom one? It looks like ax1.rowNum and colNum should refer to the parameters I want (rowNum in this case, since there is only one column). But there isn't a docstring for them. Is this there intended use (or at least a safe use of them)? 99% of the time, I will create the top one first so topfig=fig.axes[0] and bottomfig=fig.axes[1]. But if I ever screw that up, it could be bad. Thanks, Ryan - 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.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] subplots with the OO interface (ax.rowNum, ax.colNum)
On 3/20/07, Ryan Krauss [EMAIL PROTECTED] wrote: I have a figure with 2 subplots (2 rows, 1 column) created using the OO interface like this: ax1=fig.add_subplot(2,1,1) ax2=fig.add_subplot(2,1,2) After I have created these axes and plotted things on them, I want to be able to set their x and y lims. The function that creates the plot returns fig. I can then get to a list of the axes from fig.axes. My question is this: can I know from the list of axes or their individual properties which one is which - i.e. which one is the top one and which one is the bottom one? It looks like ax1.rowNum and colNum should refer to the parameters I want (rowNum in this case, since there is only one column). But there isn't a docstring for them. Is this there intended use (or at least a safe use of them)? 99% of the time, I will create the top one first so topfig=fig.axes[0] and bottomfig=fig.axes[1]. But if I ever screw that up, it could be bad. If you are creating subplots, you can do rows, cols, num = ax.get_geometry() You can also change the geometry with set_geometry. There are a couple of Subplot helper functions you may find useful, eg to selectively apply x and ylabeling: def is_first_col(self): return self.colNum==0 def is_first_row(self): return self.rowNum==0 def is_last_row(self): return self.rowNum==self.numRows-1 def is_last_col(self): return self.colNum==self.numCols-1 - 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.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] subplots with the OO interface (ax.rowNum, ax.colNum)
Thanks John. That will work. Ryan On 3/20/07, John Hunter [EMAIL PROTECTED] wrote: On 3/20/07, Ryan Krauss [EMAIL PROTECTED] wrote: I have a figure with 2 subplots (2 rows, 1 column) created using the OO interface like this: ax1=fig.add_subplot(2,1,1) ax2=fig.add_subplot(2,1,2) After I have created these axes and plotted things on them, I want to be able to set their x and y lims. The function that creates the plot returns fig. I can then get to a list of the axes from fig.axes. My question is this: can I know from the list of axes or their individual properties which one is which - i.e. which one is the top one and which one is the bottom one? It looks like ax1.rowNum and colNum should refer to the parameters I want (rowNum in this case, since there is only one column). But there isn't a docstring for them. Is this there intended use (or at least a safe use of them)? 99% of the time, I will create the top one first so topfig=fig.axes[0] and bottomfig=fig.axes[1]. But if I ever screw that up, it could be bad. If you are creating subplots, you can do rows, cols, num = ax.get_geometry() You can also change the geometry with set_geometry. There are a couple of Subplot helper functions you may find useful, eg to selectively apply x and ylabeling: def is_first_col(self): return self.colNum==0 def is_first_row(self): return self.rowNum==0 def is_last_row(self): return self.rowNum==self.numRows-1 def is_last_col(self): return self.colNum==self.numCols-1 - 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.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users