Re: [Matplotlib-users] Design questions
plt.subplots_adjust combined with ajustments in fig.set_size_inches is finally working. On Fri, Jul 31, 2009 at 11:55 AM, Tony S Yu wrote: > On Jul 30, 2009, at 5:16 PM, Gewton Jhames wrote: > > Anyone? > > On Tue, Jul 28, 2009 at 3:23 PM, Gewton Jhames wrote: > >> Guys, there is the code. >> On Tue, Jul 28, 2009 at 3:13 PM, Gewton Jhames wrote: >> >>> Jae-Joon Lee, savefig("file.png", bbox_inches="tight") doesn't work too. >>> >>> On Mon, Jul 27, 2009 at 7:00 PM, Jae-Joon Lee wrote: >>> >> [Snip] > > On Mon, Jul 27, 2009 at 4:06 PM, Gewton Jhames wrote: On the other hand, there is some crude support for trimming, i.e., reducing the figure size while the axes area fixed. savefig("file.png", bbox_inches="tight") Note that the figure size of the saved output is only affected. This does not change the figure displayed on the screen. Regards, -JJ >>> >> > Jae-Joon's suggestion worked for me (using your code). Since this feature > is pretty new, it may depend on the version you're using (I'm using the > latest from svn). > > I couldn't get `autoscale_view` to work either. However, `subplots_adjust` > should work with a little tweaking. Instead of the dimensions John gave, > try plt.subplots_adjust(left=0.07, right=0.99). These dimensions may show up > differently on your system, so try tweaking these values. > > Best, > -T > -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
On Jul 30, 2009, at 5:16 PM, Gewton Jhames wrote: Anyone? On Tue, Jul 28, 2009 at 3:23 PM, Gewton Jhames wrote: Guys, there is the code. On Tue, Jul 28, 2009 at 3:13 PM, Gewton Jhames wrote: Jae-Joon Lee, savefig("file.png", bbox_inches="tight") doesn't work too. On Mon, Jul 27, 2009 at 7:00 PM, Jae-Joon Lee wrote: [Snip] On Mon, Jul 27, 2009 at 4:06 PM, Gewton Jhames wrote: On the other hand, there is some crude support for trimming, i.e., reducing the figure size while the axes area fixed. savefig("file.png", bbox_inches="tight") Note that the figure size of the saved output is only affected. This does not change the figure displayed on the screen. Regards, -JJ Jae-Joon's suggestion worked for me (using your code). Since this feature is pretty new, it may depend on the version you're using (I'm using the latest from svn). I couldn't get `autoscale_view` to work either. However, `subplots_adjust` should work with a little tweaking. Instead of the dimensions John gave, try plt.subplots_adjust(left=0.07, right=0.99). These dimensions may show up differently on your system, so try tweaking these values. Best, -T-- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
Anyone? On Tue, Jul 28, 2009 at 3:23 PM, Gewton Jhames wrote: > Guys, there is the code. > On Tue, Jul 28, 2009 at 3:13 PM, Gewton Jhames wrote: > >> Jae-Joon Lee, savefig("file.png", bbox_inches="tight") doesn't work too. >> >> On Mon, Jul 27, 2009 at 7:00 PM, Jae-Joon Lee wrote: >> >>> On Mon, Jul 27, 2009 at 4:06 PM, Gewton Jhames wrote: >>> > How to "trim the canvas" of the image generated? It's transparent, but >>> still >>> > have a "padding", if it would be cropped, I can safe almost 200px!. I >>> have >>> > attached a file to this email to show it, the background of the graph >>> was >>> > set to red only to you see the padding. >>> >>> As John suggested, you can adjust the subplot params. This adjusts the >>> area occupied by the axes, while the figure size (canvas size) is >>> fixed. >>> >>> The subplot params can be automatically adjusted. >>> >>> >>> http://matplotlib.sourceforge.net/faq/howto_faq.html?highlight=automatic%20adjust#automatically-make-room-for-tick-labels >>> >>> >>> On the other hand, there is some crude support for trimming, i.e., >>> reducing the figure size while the axes area fixed. >>> >>> savefig("file.png", bbox_inches="tight") >>> >>> Note that the figure size of the saved output is only affected. This >>> does not change the figure displayed on the screen. >>> >>> Regards, >>> >>> -JJ >>> >> >> > -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
Guys, there is the code. On Tue, Jul 28, 2009 at 3:13 PM, Gewton Jhames wrote: > Jae-Joon Lee, savefig("file.png", bbox_inches="tight") doesn't work too. > > On Mon, Jul 27, 2009 at 7:00 PM, Jae-Joon Lee wrote: > >> On Mon, Jul 27, 2009 at 4:06 PM, Gewton Jhames wrote: >> > How to "trim the canvas" of the image generated? It's transparent, but >> still >> > have a "padding", if it would be cropped, I can safe almost 200px!. I >> have >> > attached a file to this email to show it, the background of the graph >> was >> > set to red only to you see the padding. >> >> As John suggested, you can adjust the subplot params. This adjusts the >> area occupied by the axes, while the figure size (canvas size) is >> fixed. >> >> The subplot params can be automatically adjusted. >> >> >> http://matplotlib.sourceforge.net/faq/howto_faq.html?highlight=automatic%20adjust#automatically-make-room-for-tick-labels >> >> >> On the other hand, there is some crude support for trimming, i.e., >> reducing the figure size while the axes area fixed. >> >> savefig("file.png", bbox_inches="tight") >> >> Note that the figure size of the saved output is only affected. This >> does not change the figure displayed on the screen. >> >> Regards, >> >> -JJ >> > > graph.py Description: Binary data -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
Jae-Joon Lee, savefig("file.png", bbox_inches="tight") doesn't work too. On Mon, Jul 27, 2009 at 7:00 PM, Jae-Joon Lee wrote: > On Mon, Jul 27, 2009 at 4:06 PM, Gewton Jhames wrote: > > How to "trim the canvas" of the image generated? It's transparent, but > still > > have a "padding", if it would be cropped, I can safe almost 200px!. I > have > > attached a file to this email to show it, the background of the graph was > > set to red only to you see the padding. > > As John suggested, you can adjust the subplot params. This adjusts the > area occupied by the axes, while the figure size (canvas size) is > fixed. > > The subplot params can be automatically adjusted. > > > http://matplotlib.sourceforge.net/faq/howto_faq.html?highlight=automatic%20adjust#automatically-make-room-for-tick-labels > > > On the other hand, there is some crude support for trimming, i.e., > reducing the figure size while the axes area fixed. > > savefig("file.png", bbox_inches="tight") > > Note that the figure size of the saved output is only affected. This > does not change the figure displayed on the screen. > > Regards, > > -JJ > -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
John Hunter, ax.autoscale_view(tight=True, scaley=False) didn't work. I put it before and after plot. Didn't work in any case. the first one, fig.subplots_adjust(left=0.05, bottom=0.05, top=0.05, right=0.05), didn't work too. It let's the graph crazy. If you want, I can put the code here. On Mon, Jul 27, 2009 at 6:32 PM, John Hunter wrote: > On Mon, Jul 27, 2009 at 3:06 PM, Gewton Jhames wrote: > > Thanks everyone. Everything works perfectly. > > Only a few things left: > > > > How to "trim the canvas" of the image generated? It's transparent, but > still > > have a "padding", if it would be cropped, I can safe almost 200px!. I > have > > attached a file to this email to show it, the background of the graph was > > set to red only to you see the padding. > > use > > fig.subplots_adjust(left=0.05, bottom=0.05, top=0.05, right=0.05) > > etc to trim the excess space > > > In the file attached to this email, the graph have a space after the > > position 23:00, I wish to remove it. > > Several ways to do it: one is: > > ax.autoscale_view(tight=True, scaley=False) > > Use > -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
On Mon, Jul 27, 2009 at 4:06 PM, Gewton Jhames wrote: > How to "trim the canvas" of the image generated? It's transparent, but still > have a "padding", if it would be cropped, I can safe almost 200px!. I have > attached a file to this email to show it, the background of the graph was > set to red only to you see the padding. As John suggested, you can adjust the subplot params. This adjusts the area occupied by the axes, while the figure size (canvas size) is fixed. The subplot params can be automatically adjusted. http://matplotlib.sourceforge.net/faq/howto_faq.html?highlight=automatic%20adjust#automatically-make-room-for-tick-labels On the other hand, there is some crude support for trimming, i.e., reducing the figure size while the axes area fixed. savefig("file.png", bbox_inches="tight") Note that the figure size of the saved output is only affected. This does not change the figure displayed on the screen. Regards, -JJ -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
On Mon, Jul 27, 2009 at 3:06 PM, Gewton Jhames wrote: > Thanks everyone. Everything works perfectly. > Only a few things left: > > How to "trim the canvas" of the image generated? It's transparent, but still > have a "padding", if it would be cropped, I can safe almost 200px!. I have > attached a file to this email to show it, the background of the graph was > set to red only to you see the padding. use fig.subplots_adjust(left=0.05, bottom=0.05, top=0.05, right=0.05) etc to trim the excess space > In the file attached to this email, the graph have a space after the > position 23:00, I wish to remove it. Several ways to do it: one is: ax.autoscale_view(tight=True, scaley=False) Use -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
On Mon, Jul 27, 2009 at 10:55 AM, Tony S Yu wrote: > Below is some code to do 1, 2, and 4. > The 3rd issue is a bit more difficult. One approach is to use > Jae-Joon's AxesGrid toolkit; you > may need to be using the latest development version of matplotlib to use the toolkit. > BTW, does anyone know why it's ``ax.set_axis_bgcolor`` instead of > ``ax.set_facecolor``? very old legacy where the axis background color "bgcolor" predated the existance of an axes patch with the unified kwargs. If people want to deprecate it in favor of ax.patch.set_facecolor(color) I don't object. JDH -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
That's right Gökhan, I should have thought on it before ask. Thanks. Only the first one remains... this one I could not find a way. I know there is one class called FigureCanvasAgg, but I didn't find anything on it. On Mon, Jul 27, 2009 at 5:16 PM, Gökhan SEVER wrote: > For the 2nd one; > > To re-position the figure content you might use axis(xmin= , xmax= ) > > > On Mon, Jul 27, 2009 at 3:06 PM, Gewton Jhames wrote: > >> Thanks everyone. Everything works perfectly. >> Only a few things left: >> >>1. How to "trim the canvas" of the image generated? It's transparent, >>but still have a "padding", if it would be cropped, I can safe almost >>200px!. I have attached a file to this email to show it, the background of >>the graph was set to red only to you see the padding. >>2. In the file attached to this email, the graph have a space after >>the position 23:00, I wish to remove it. >> >> >> On Mon, Jul 27, 2009 at 1:37 PM, Jae-Joon Lee wrote: >> >>> On Mon, Jul 27, 2009 at 11:55 AM, Tony S Yu wrote: >>> > The 3rd issue is a bit more difficult. One approach is to use >>> > Jae-Joon's AxesGrid toolkit; you >>> > >>> may need to be using the latest development version of matplotlib to use >>> the toolkit. >>> >>> I think it would be easier to use the recently added spine support, >>> because using the AxesGrid toolkit has some side-effects. >>> >>> >>> http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html >>> >>> Regards, >>> >>> -JJ >>> >> >> >> >> -- >> >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > > -- > Gökhan > -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
For the 2nd one; To re-position the figure content you might use axis(xmin= , xmax= ) On Mon, Jul 27, 2009 at 3:06 PM, Gewton Jhames wrote: > Thanks everyone. Everything works perfectly. > Only a few things left: > >1. How to "trim the canvas" of the image generated? It's transparent, >but still have a "padding", if it would be cropped, I can safe almost >200px!. I have attached a file to this email to show it, the background of >the graph was set to red only to you see the padding. >2. In the file attached to this email, the graph have a space after the >position 23:00, I wish to remove it. > > > On Mon, Jul 27, 2009 at 1:37 PM, Jae-Joon Lee wrote: > >> On Mon, Jul 27, 2009 at 11:55 AM, Tony S Yu wrote: >> > The 3rd issue is a bit more difficult. One approach is to use >> > Jae-Joon's AxesGrid toolkit; you >> > >> may need to be using the latest development version of matplotlib to use the >> toolkit. >> >> I think it would be easier to use the recently added spine support, >> because using the AxesGrid toolkit has some side-effects. >> >> >> http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html >> >> Regards, >> >> -JJ >> > > > > -- > > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- Gökhan -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
Thanks everyone. Everything works perfectly. Only a few things left: 1. How to "trim the canvas" of the image generated? It's transparent, but still have a "padding", if it would be cropped, I can safe almost 200px!. I have attached a file to this email to show it, the background of the graph was set to red only to you see the padding. 2. In the file attached to this email, the graph have a space after the position 23:00, I wish to remove it. On Mon, Jul 27, 2009 at 1:37 PM, Jae-Joon Lee wrote: > On Mon, Jul 27, 2009 at 11:55 AM, Tony S Yu wrote: > > The 3rd issue is a bit more difficult. One approach is to use > > Jae-Joon's AxesGrid toolkit; you > > > may need to be using the latest development version of matplotlib to use the > toolkit. > > I think it would be easier to use the recently added spine support, > because using the AxesGrid toolkit has some side-effects. > > > http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html > > Regards, > > -JJ > <>-- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
On Mon, Jul 27, 2009 at 11:55 AM, Tony S Yu wrote: > The 3rd issue is a bit more difficult. One approach is to use > Jae-Joon's AxesGrid toolkit; you > may need to be using the latest development version of matplotlib to use the toolkit. I think it would be easier to use the recently added spine support, because using the AxesGrid toolkit has some side-effects. http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html Regards, -JJ -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
Below is some code to do 1, 2, and 4. The 3rd issue is a bit more difficult. One approach is to use Jae- Joon's AxesGrid toolkit; you may need to be using the latest development version of matplotlib to use the toolkit. BTW, does anyone know why it's ``ax.set_axis_bgcolor`` instead of ``ax.set_facecolor``? Best, -Tony % == import numpy as np import matplotlib.pyplot as plt fig = plt.figure(frameon=False) ax = plt.gca() light_gray = (.8, .8, .8) dark_gray = (.2, .2, .2) x = np.random.random_integers(1, 10, 50) n, bins, patches = ax.hist(x, facecolor='#658A2F') for p in patches: p.set_edgecolor(dark_gray) ax.set_axis_bgcolor(light_gray) ax.yaxis.grid(color='w', linestyle='-') # Assuming you want the gridlines below the bars ax.set_axisbelow(True) plt.show() On Jul 27, 2009, at 11:22 AM, Gewton Jhames wrote: thanks!! only 4 left. On Mon, Jul 27, 2009 at 11:31 AM, Gökhan SEVER wrote: For the 5th one ;) figure(frameon=False) On Mon, Jul 27, 2009 at 8:26 AM, Gewton Jhames wrote: Hello, would you help me in some design issues that I wish to put in my matplotlib graph? I want my graph look like the one that I'm attaching on this email: Change the Background-color of the axis to gray; Display only horizontal lines on the axis, in white color; Display only the border-left and the border-bottom of the graph, and in 2px of width; Change the border-color of the bars of the graphics (to a more dark gray). Save in a transparent png. Can anyone know how to change any of these features? thanks. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Gökhan -- ___ 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
Re: [Matplotlib-users] Design questions
thanks!! only 4 left. On Mon, Jul 27, 2009 at 11:31 AM, Gökhan SEVER wrote: > For the 5th one ;) > > figure(frameon=False) > > On Mon, Jul 27, 2009 at 8:26 AM, Gewton Jhames wrote: > >> Hello, would you help me in some design issues that I wish to put in my >> matplotlib graph? >> I want my graph look like the one that I'm attaching on this email: >> >> >>- Change the Background-color of the axis to gray; >>- Display only horizontal lines on the axis, in white color; >>- Display only the border-left and the border-bottom of the graph, and >>in 2px of width; >>- Change the border-color of the bars of the graphics (to a more dark >>gray). >>- Save in a transparent png. >> >> >> Can anyone know how to change any of these features? thanks. >> >> >> -- >> >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > > -- > Gökhan > -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
For the 5th one ;) figure(frameon=False) On Mon, Jul 27, 2009 at 8:26 AM, Gewton Jhames wrote: > Hello, would you help me in some design issues that I wish to put in my > matplotlib graph? > I want my graph look like the one that I'm attaching on this email: > > >- Change the Background-color of the axis to gray; >- Display only horizontal lines on the axis, in white color; >- Display only the border-left and the border-bottom of the graph, and >in 2px of width; >- Change the border-color of the bars of the graphics (to a more dark >gray). >- Save in a transparent png. > > > Can anyone know how to change any of these features? thanks. > > > -- > > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- Gökhan -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users