Re: [Matplotlib-users] AXES properties
Are you using the axes_grid toolkit? Standard matplotlib axis instance does not have major_ticklabels attribute, while axes_grid axis does. Please post a simple, but complete example that can be run and tested. Regards, -JJ On Sun, Jan 31, 2010 at 11:06 AM, kc106_2005-matplot...@yahoo.com wrote: BTW: I tried to use set_position to change the position of the axes label as suggested by previous posting. No effect. - Original Message Hello, I am creating a plot with multiple y-axis (up to 6) and twinx works pretty well. The problem is that there are too much wasted spaces used up by the axes. Since I have multiple axes, it cuts into the amount of space available for the plot area. I need to know how I can squeeze some spaces out of the standard axes. First thing I discovered was that I can rotate the tick labels to vertical by: plt.setp(ax.major_ticklabels, rotation=vertical) where ax is my y-axis. But then: (1) How to reduce the space between the tick and the axes label? First I tried to place the label on top but couldn't get that to work. Then I tried to change the position property of the axis label object and that have no effect. So, can somebody please tell me how I can do these 2 things? (2) How to avoid overlapping tick labels? With the way the standard x and y axis are drawn, after I do a vertical rotate of the y tick labels, the first y tick label overlaps with the last x tick label since they are both center aligned. Is there any way to change the alignment of only the first and last tick labels of an axes (while keeping the rest center aligned)? Thanks, -- John Henry -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] AXES properties
set_position does not work with axes_grid toolkits. Try something like ax.LABELPAD = 0 However, note that this (and set_rotation) may not work with mpl_toolkits in future release of matplotlib as there has been some significant changes. Regards, -JJ ps. please use reply to all, so that messages stay inside the list. On Mon, Feb 1, 2010 at 7:52 PM, Kim Cheung ecs1...@gmail.com wrote: Mr. Lee, Thanks for the reply. The position call works with the first example but not the second: # Example 1 import pylab data1=[1,2,3,4,5,6,7] data2=[8,9,10,11,12,13,14] dates=['01','02','03','04','05','06','07'] pylab.subplot(211) pylab.plot(data1, label='Score 2005') pylab.plot(data2, label='Num 2006') pylab.setp(pylab.gca(), xticklabels=[]) pylab.ylabel('Score 2') pylab.title('Historical Statistics') pylab.legend(loc='upper left') pylab.subplot(212) pylab.plot(data1, label='Score 06') pylab.plot(data2, label='Num 06') pylab.xticks(pylab.arange(7),dates) xlabels = pylab.gca().get_xticklabels() ylabels = pylab.gca().get_yticklabels() pylab.setp(xlabels, 'rotation', 90) xlab=pylab.xlabel('Player') pylab.setp(xlab, position=(0.2,0.1)) # === This line works pylab.ylabel('Score 1') pylab.legend(loc='upper left') pylab.show() But doesn't work in this example: # Example 2 from mpl_toolkits.axes_grid.parasite_axes import SubplotHost import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator, FormatStrFormatter if 1: figprops = dict(figsize=(8., 8. / 1.618), dpi=128) # Figure properties adjustprops = dict(left=0.08, bottom=0.12, right=0.79, top=0.96, wspace=0.2, hspace=0.2) # Subplot properties fig = plt.figure(**figprops) fig.subplots_adjust(**adjustprops) # Tunes the subplot layout host = SubplotHost(fig, 111) p0, = host.plot([0, 1, 2], [0, 1, 2], label=Density) ax=host.axis[left] plt.setp(ax.label, visible=True, text=Density, size=12, color=p0.get_color()) plt.setp(ax.major_ticklabels, rotation=vertical) plt.setp(ax.label, position=(0.2,0.1)) # This line has no effect. fig.add_axes(host) host.set_xlim(0, 2) host.set_ylim(0, 2) host.legend() plt.draw() plt.show() Jae-Joon Lee wrote: Are you using the axes_grid toolkit? Standard matplotlib axis instance does not have major_ticklabels attribute, while axes_grid axis does. Please post a simple, but complete example that can be run and tested. Regards, -JJ On Sun, Jan 31, 2010 at 11:06 AM, kc106_2005-matplot...@yahoo.com wrote: BTW: I tried to use set_position to change the position of the axes label as suggested by previous posting. No effect. - Original Message Hello, I am creating a plot with multiple y-axis (up to 6) and twinx works pretty well. The problem is that there are too much wasted spaces used up by the axes. Since I have multiple axes, it cuts into the amount of space available for the plot area. I need to know how I can squeeze some spaces out of the standard axes. First thing I discovered was that I can rotate the tick labels to vertical by: plt.setp(ax.major_ticklabels, rotation=vertical) where ax is my y-axis. But then: (1) How to reduce the space between the tick and the axes label? First I tried to place the label on top but couldn't get that to work. Then I tried to change the position property of the axis label object and that have no effect. So, can somebody please tell me how I can do these 2 things? (2) How to avoid overlapping tick labels? With the way the standard x and y axis are drawn, after I do a vertical rotate of the y tick labels, the first y tick label overlaps with the last x tick label since they are both center aligned. Is there any way to change the alignment of only the first and last tick labels of an axes (while keeping the rest center aligned)? Thanks, -- John Henry -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Kim Cheung -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com
[Matplotlib-users] AXES properties
BTW: I tried to use set_position to change the position of the axes label as suggested by previous posting. No effect. - Original Message Hello, I am creating a plot with multiple y-axis (up to 6) and twinx works pretty well. The problem is that there are too much wasted spaces used up by the axes. Since I have multiple axes, it cuts into the amount of space available for the plot area. I need to know how I can squeeze some spaces out of the standard axes. First thing I discovered was that I can rotate the tick labels to vertical by: plt.setp(ax.major_ticklabels, rotation=vertical) where ax is my y-axis. But then: (1) How to reduce the space between the tick and the axes label? First I tried to place the label on top but couldn't get that to work. Then I tried to change the position property of the axis label object and that have no effect. So, can somebody please tell me how I can do these 2 things? (2) How to avoid overlapping tick labels? With the way the standard x and y axis are drawn, after I do a vertical rotate of the y tick labels, the first y tick label overlaps with the last x tick label since they are both center aligned. Is there any way to change the alignment of only the first and last tick labels of an axes (while keeping the rest center aligned)? Thanks, -- John Henry -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] AXES properties
Hello, I am creating a plot with multiple y-axis (up to 6) and twinx works pretty well. The problem is that there are too much wasted spaces used up by the axes. Since I have multiple axes, it cuts into the amount of space available for the plot area. I need to know how I can squeeze some spaces out of the standard axes. First thing I discovered was that I can rotate the tick labels to vertical by: plt.setp(ax.major_ticklabels, rotation=vertical) where ax is my y-axis. But then: (1) How to reduce the space between the tick and the axes label? First I tried to place the label on top but couldn't get that to work. Then I tried to change the position property of the axis label object and that have no effect. So, can somebody please tell me how I can do these 2 things? (2) How to avoid overlapping tick labels? With the way the standard x and y axis are drawn, after I do a vertical rotate of the y tick labels, the first y tick label overlaps with the last x tick label since they are both center aligned. Is there any way to change the alignment of only the first and last tick labels of an axes (while keeping the rest center aligned)? Thanks, -- John Henry -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users