Re: [Matplotlib-users] UserWarning: Attempting to set identical bottom==top
On Fri, May 6, 2011 at 10:33 AM, Benjamin Root wrote: > On Thu, May 5, 2011 at 10:01 PM, C M wrote: >> >> > Because you have a py2exe'ed program, I suspect that whoever packaged >> > the >> > program should be the one to modify that program to choose its axes >> > limits >> > more robustly in order to avoid the warning message. >> >> Maybe I have been unclear. I am the sole developer of this >> application, and I occasionally test it as a py2exe'd app in >> anticipation of delivering it in that form at some point. I would be >> happy to modify the program to choose its axes limits more >> robustly--if I only knew how to do that. That is what I am asking. >> How should I do that? >> >> The data to be plotted is a very simple date plot with dates on the x >> axis and values (formatted as time) on the y axis. >> >> Che > > Most likely, somewhere in your code, you have a call to set_ylim(), and are > likely setting it to the minimum and maximum values of the data you are > plotting. This is where the problem comes in. There are several options to > go about avoiding the problem here. One is to not call set_ylim() at all if > you have only one data point, and just let matplotlib figure out the > y-limits automatically. Another approach is to call set_ylim() with > parameters that have an explicit amount of padding, like the following: > > ax.set_ylim(y.min() - 0.5, y.max() + 0.5) > > This way, you are guaranteed that the top and bottom limits will never be > the same. The best approach is up to you. > > I hope that helps! > Ben Root Thank you, Ben! That helps a lot. Adding some padding myself seems to fix it. And it's good to understand what was occurring. -Che -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] UserWarning: Attempting to set identical bottom==top
On Thu, May 5, 2011 at 10:01 PM, C M wrote: > > Because you have a py2exe'ed program, I suspect that whoever packaged the > > program should be the one to modify that program to choose its axes > limits > > more robustly in order to avoid the warning message. > > Maybe I have been unclear. I am the sole developer of this > application, and I occasionally test it as a py2exe'd app in > anticipation of delivering it in that form at some point. I would be > happy to modify the program to choose its axes limits more > robustly--if I only knew how to do that. That is what I am asking. > How should I do that? > > The data to be plotted is a very simple date plot with dates on the x > axis and values (formatted as time) on the y axis. > > Che > Most likely, somewhere in your code, you have a call to set_ylim(), and are likely setting it to the minimum and maximum values of the data you are plotting. This is where the problem comes in. There are several options to go about avoiding the problem here. One is to not call set_ylim() at all if you have only one data point, and just let matplotlib figure out the y-limits automatically. Another approach is to call set_ylim() with parameters that have an explicit amount of padding, like the following: ax.set_ylim(y.min() - 0.5, y.max() + 0.5) This way, you are guaranteed that the top and bottom limits will never be the same. The best approach is up to you. I hope that helps! Ben Root -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] UserWarning: Attempting to set identical bottom==top
> Because you have a py2exe'ed program, I suspect that whoever packaged the > program should be the one to modify that program to choose its axes limits > more robustly in order to avoid the warning message. Maybe I have been unclear. I am the sole developer of this application, and I occasionally test it as a py2exe'd app in anticipation of delivering it in that form at some point. I would be happy to modify the program to choose its axes limits more robustly--if I only knew how to do that. That is what I am asking. How should I do that? The data to be plotted is a very simple date plot with dates on the x axis and values (formatted as time) on the y axis. Che -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] UserWarning: Attempting to set identical bottom==top
On Thu, May 5, 2011 at 9:04 PM, C M wrote: > On Thu, May 5, 2011 at 10:03 PM, C M wrote: > > On Thu, May 5, 2011 at 7:58 PM, Benjamin Root wrote: > >> > >> > >> On Sun, May 1, 2011 at 4:35 PM, C M wrote: > >>> > >>> I get this error and would like to know what to do to eliminate it and > >>> also what it means: > >>> > >>> C:\Python25\lib\site-packages\matplotlib\axes.py:2571: > >>> UserWarning: Attempting to set identical bottom==top results > >>> in singular transformations; automatically expanding. > >>> bottom=0, top=0 + 'bottom=%s, top=%s') % (bottom, top)) > >>> > >>> This is with Matplotlib 1.0.0. > >>> > >>> Thank you, > >>> Che > >>> > >> > > I have seen this happen when the plot is set to use the limits of the > data > > to guide the axes limits, but the data being displayed is either vertical > or > > horizontal. > > What do you mean by the data being vertical or horizontal? I can get > this error with a single point that is plotted on a time vs. values > plot. > > Or even a single point. In other words, if the bounding box encompassing the data being plotted can be reduced to a 1 or 0 dimensional representation, then matplotlib will auto-pad this so that the rest of matplotlib won't crash. > > It isn't a huge issue as the code is automatically padding the > > axes to make take the plot out of "flat world". > > The problem is, when I use a py2exe'd app this error occurs and the > user sees a message to see the log file for the error. I don't want > that at all. It's a bad user experience. > The warning message is important because it is usually an indication that the program is doing something wrong. If you (and by "you", I mean the program) might be plotting a single point or something that can be reduced to 1 or 0 dimensions, then you should not have the axes automatically set its limits from the data without pads. Because you have a py2exe'ed program, I suspect that whoever packaged the program should be the one to modify that program to choose its axes limits more robustly in order to avoid the warning message. Unless the other developers feel differently, I am against suppressing this warning message. I hope that makes things clearer. Ben Root -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] UserWarning: Attempting to set identical bottom==top
On Thu, May 5, 2011 at 10:03 PM, C M wrote: > On Thu, May 5, 2011 at 7:58 PM, Benjamin Root wrote: >> >> >> On Sun, May 1, 2011 at 4:35 PM, C M wrote: >>> >>> I get this error and would like to know what to do to eliminate it and >>> also what it means: >>> >>> C:\Python25\lib\site-packages\matplotlib\axes.py:2571: >>> UserWarning: Attempting to set identical bottom==top results >>> in singular transformations; automatically expanding. >>> bottom=0, top=0 + 'bottom=%s, top=%s') % (bottom, top)) >>> >>> This is with Matplotlib 1.0.0. >>> >>> Thank you, >>> Che >>> >> > I have seen this happen when the plot is set to use the limits of the data > to guide the axes limits, but the data being displayed is either vertical or > horizontal. What do you mean by the data being vertical or horizontal? I can get this error with a single point that is plotted on a time vs. values plot. > It isn't a huge issue as the code is automatically padding the > axes to make take the plot out of "flat world". The problem is, when I use a py2exe'd app this error occurs and the user sees a message to see the log file for the error. I don't want that at all. It's a bad user experience. Is there a way I can prevent this error from ever being generated? Thanks. -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] UserWarning: Attempting to set identical bottom==top
On Sun, May 1, 2011 at 4:35 PM, C M wrote: > I get this error and would like to know what to do to eliminate it and > also what it means: > > C:\Python25\lib\site-packages\matplotlib\axes.py:2571: > UserWarning: Attempting to set identical bottom==top results > in singular transformations; automatically expanding. > bottom=0, top=0 + 'bottom=%s, top=%s') % (bottom, top)) > > This is with Matplotlib 1.0.0. > > Thank you, > Che > > I have seen this happen when the plot is set to use the limits of the data to guide the axes limits, but the data being displayed is either vertical or horizontal. It isn't a huge issue as the code is automatically padding the axes to make take the plot out of "flat world". Ben Root -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] UserWarning: Attempting to set identical bottom==top
I get this error and would like to know what to do to eliminate it and also what it means: C:\Python25\lib\site-packages\matplotlib\axes.py:2571: UserWarning: Attempting to set identical bottom==top results in singular transformations; automatically expanding. bottom=0, top=0 + 'bottom=%s, top=%s') % (bottom, top)) This is with Matplotlib 1.0.0. Thank you, Che -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users