Re: [matplotlib-devel] Plot line style cycle?
Just brain-storming here... What about two rcparams: cycle.color = true and cycle.style = false? This way, cycling for both colors and line styles could be turned on and off accordingly. Then, a b&w mode could utilize this. as well as possibly substitute default values. Ben Root On Thursday, August 25, 2011, Eric Firing wrote: > On 08/25/2011 04:09 AM, Benjamin Root wrote: >> I am currently in the process of a paper submission, and the page charge >> estimation took us for a bit of a surprise. Luckily, most of my plots >> don't need color, and I would like to regenerate them in b&w mode. >> >> Is there some default line style cycle (I.e., ['-', '.', '--', '.-']) >> that can be set analogous to the color cycle used by default? > > Something like this came up a while ago as a feature request--same sort > of motivation, I think--but it was never implemented. > > You could make a little function that would operate on line objects, > changing colors from the color cycle to black while using those colors > to specify line styles. > > Eric > >> >> Thanks, >> Ben Root > > -- > EMC VNX: the world's simplest storage, starting under $10K > The only unified storage solution that offers unified management > Up to 160% more powerful than alternatives and 25% more efficient. > Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] graphics context: use alpha value from foreground color if present
Dear all, I am currently modifying the MacOSX backend to make its interactive/non-interactive behavior consistent with the other backends in matplotlib. When I was testing the backend, I found a new bug that seems to be related to a recent change in backend_bases.py: https://github.com/matplotlib/matplotlib/commit/4c078ddf68cc0ecc1a5f36009a3e3a8b4921b037#lib/matplotlib/backend_bases.py After this commit, GraphicsContextBase.set_alpha has no effect if alpha==None; previously it would set alpha to 1.0. The bug appears here in Text.draw in text.py: gc = renderer.new_gc() gc.set_foreground(self.get_color()) gc.set_alpha(self.get_alpha()) In this code, self is a Text object, which derives from the Artist class, which initializes its _alpha member to None. So self.get_alpha() returns None, and gc.set_alpha has no effect. The alpha value used then depends on whatever was present in the gc before the call to new_gc, which is backend-dependent; the MacOSX and cairo backends end up with an incorrect alpha value. I guess the easiest solution is to initialize _alpha in the Artist class to 1.0 instead of to None. Thanks, --Michiel -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] graphics context: use alpha value from foreground color if present
On 08/26/2011 06:23 AM, Michiel de Hoon wrote: > Dear all, > > I am currently modifying the MacOSX backend to make its > interactive/non-interactive behavior consistent with the other backends in > matplotlib. > When I was testing the backend, I found a new bug that seems to be related to > a recent change in backend_bases.py: > > https://github.com/matplotlib/matplotlib/commit/4c078ddf68cc0ecc1a5f36009a3e3a8b4921b037#lib/matplotlib/backend_bases.py > > After this commit, GraphicsContextBase.set_alpha has no effect if > alpha==None; previously it would set alpha to 1.0. > > The bug appears here in Text.draw in text.py: > > gc = renderer.new_gc() > gc.set_foreground(self.get_color()) > gc.set_alpha(self.get_alpha()) > > In this code, self is a Text object, which derives from the Artist class, > which initializes its _alpha member to None. So self.get_alpha() returns > None, and gc.set_alpha has no effect. The alpha value used then depends on > whatever was present in the gc before the call to new_gc, which is > backend-dependent; the MacOSX and cairo backends end up with an incorrect > alpha value. > > I guess the easiest solution is to initialize _alpha in the Artist class to > 1.0 instead of to None. No, I think this will foul up all sorts of thing. I will take a look at this today or tomorrow at the latest. Eric > > Thanks, > --Michiel > -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] graphics context: use alpha value from foreground color if present
On 08/26/2011 06:23 AM, Michiel de Hoon wrote: > Dear all, > > I am currently modifying the MacOSX backend to make its > interactive/non-interactive behavior consistent with the other backends in > matplotlib. > When I was testing the backend, I found a new bug that seems to be related to > a recent change in backend_bases.py: Michiel, Thank you for doing this work on the MacOSX backend; sorry to have introduced a bug that you stumbled over. > > https://github.com/matplotlib/matplotlib/commit/4c078ddf68cc0ecc1a5f36009a3e3a8b4921b037#lib/matplotlib/backend_bases.py > > After this commit, GraphicsContextBase.set_alpha has no effect if > alpha==None; previously it would set alpha to 1.0. > > The bug appears here in Text.draw in text.py: > > gc = renderer.new_gc() > gc.set_foreground(self.get_color()) > gc.set_alpha(self.get_alpha()) > > In this code, self is a Text object, which derives from the Artist class, > which initializes its _alpha member to None. So self.get_alpha() returns > None, and gc.set_alpha has no effect. The alpha value used then depends on > whatever was present in the gc before the call to new_gc, which is > backend-dependent; the MacOSX and cairo backends end up with an incorrect > alpha value. > > I guess the easiest solution is to initialize _alpha in the Artist class to > 1.0 instead of to None. See https://github.com/matplotlib/matplotlib/pull/437 The problem was occurring because the macosx and cairo backends were recycling their graphics context objects instead of making new instances, so they were not getting initialized. I made a local fix by initializing the _alpha attributes; it may be that other initialization is actually needed as well, and that the GraphicsContextBase.__init__ method should be called, but I have not looked into that. The small fix solves the immediate problem. In addition, I realized that a small change in GraphicsContextBase was needed to properly support backends that have their own set_alpha and set_foreground methods in their gc class. Eric > > Thanks, > --Michiel -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] graphics context: use alpha value from foreground color if present
Thanks! That solves the problem for me. Once these changes have made it into trunk, I can commit my changes to the MacOSX backend. Thanks, --Michiel --- On Fri, 8/26/11, Eric Firing wrote: > From: Eric Firing > Subject: Re: [matplotlib-devel] graphics context: use alpha value from > foreground color if present > To: matplotlib-devel@lists.sourceforge.net > Date: Friday, August 26, 2011, 10:20 PM > On 08/26/2011 06:23 AM, Michiel de > Hoon wrote: > > Dear all, > > > > I am currently modifying the MacOSX backend to make > its interactive/non-interactive behavior consistent with the > other backends in matplotlib. > > When I was testing the backend, I found a new bug that > seems to be related to a recent change in backend_bases.py: > > Michiel, > > Thank you for doing this work on the MacOSX backend; sorry > to have > introduced a bug that you stumbled over. > > > > > https://github.com/matplotlib/matplotlib/commit/4c078ddf68cc0ecc1a5f36009a3e3a8b4921b037#lib/matplotlib/backend_bases.py > > > > After this commit, GraphicsContextBase.set_alpha has > no effect if alpha==None; previously it would set alpha to > 1.0. > > > > The bug appears here in Text.draw in text.py: > > > > gc = > renderer.new_gc() > > > gc.set_foreground(self.get_color()) > > > gc.set_alpha(self.get_alpha()) > > > > In this code, self is a Text object, which derives > from the Artist class, which initializes its _alpha member > to None. So self.get_alpha() returns None, and gc.set_alpha > has no effect. The alpha value used then depends on whatever > was present in the gc before the call to new_gc, which is > backend-dependent; the MacOSX and cairo backends end up with > an incorrect alpha value. > > > > I guess the easiest solution is to initialize _alpha > in the Artist class to 1.0 instead of to None. > > See https://github.com/matplotlib/matplotlib/pull/437 > > The problem was occurring because the macosx and cairo > backends were > recycling their graphics context objects instead of making > new > instances, so they were not getting initialized. I > made a local fix by > initializing the _alpha attributes; it may be that other > initialization > is actually needed as well, and that the > GraphicsContextBase.__init__ > method should be called, but I have not looked into > that. The small fix > solves the immediate problem. > > In addition, I realized that a small change in > GraphicsContextBase was > needed to properly support backends that have their own > set_alpha and > set_foreground methods in their gc class. > > Eric > > > > > Thanks, > > --Michiel > > -- > EMC VNX: the world's simplest storage, starting under $10K > The only unified storage solution that offers unified > management > Up to 160% more powerful than alternatives and 25% more > efficient. > Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] graphics context: use alpha value from foreground color if present
On 08/26/2011 08:21 PM, Michiel de Hoon wrote: > Thanks! That solves the problem for me. > Once these changes have made it into trunk, I can commit my changes to the > MacOSX backend. Done--I hit the merge button. Eric > > Thanks, > --Michiel > > --- On Fri, 8/26/11, Eric Firing wrote: > >> From: Eric Firing >> Subject: Re: [matplotlib-devel] graphics context: use alpha value from >> foreground color if present >> To: matplotlib-devel@lists.sourceforge.net >> Date: Friday, August 26, 2011, 10:20 PM >> On 08/26/2011 06:23 AM, Michiel de >> Hoon wrote: >>> Dear all, >>> >>> I am currently modifying the MacOSX backend to make >> its interactive/non-interactive behavior consistent with the >> other backends in matplotlib. >>> When I was testing the backend, I found a new bug that >> seems to be related to a recent change in backend_bases.py: >> >> Michiel, >> >> Thank you for doing this work on the MacOSX backend; sorry >> to have >> introduced a bug that you stumbled over. >> >>> >>> https://github.com/matplotlib/matplotlib/commit/4c078ddf68cc0ecc1a5f36009a3e3a8b4921b037#lib/matplotlib/backend_bases.py >>> >>> After this commit, GraphicsContextBase.set_alpha has >> no effect if alpha==None; previously it would set alpha to >> 1.0. >>> >>> The bug appears here in Text.draw in text.py: >>> >>>gc = >> renderer.new_gc() >>> >> gc.set_foreground(self.get_color()) >>> >> gc.set_alpha(self.get_alpha()) >>> >>> In this code, self is a Text object, which derives >> from the Artist class, which initializes its _alpha member >> to None. So self.get_alpha() returns None, and gc.set_alpha >> has no effect. The alpha value used then depends on whatever >> was present in the gc before the call to new_gc, which is >> backend-dependent; the MacOSX and cairo backends end up with >> an incorrect alpha value. >>> >>> I guess the easiest solution is to initialize _alpha >> in the Artist class to 1.0 instead of to None. >> >> See https://github.com/matplotlib/matplotlib/pull/437 >> >> The problem was occurring because the macosx and cairo >> backends were >> recycling their graphics context objects instead of making >> new >> instances, so they were not getting initialized. I >> made a local fix by >> initializing the _alpha attributes; it may be that other >> initialization >> is actually needed as well, and that the >> GraphicsContextBase.__init__ >> method should be called, but I have not looked into >> that. The small fix >> solves the immediate problem. >> >> In addition, I realized that a small change in >> GraphicsContextBase was >> needed to properly support backends that have their own >> set_alpha and >> set_foreground methods in their gc class. >> >> Eric >> >>> >>> Thanks, >>> --Michiel >> >> -- >> EMC VNX: the world's simplest storage, starting under $10K >> The only unified storage solution that offers unified >> management >> Up to 160% more powerful than alternatives and 25% more >> efficient. >> Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev >> ___ >> Matplotlib-devel mailing list >> Matplotlib-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >> > > -- > EMC VNX: the world's simplest storage, starting under $10K > The only unified storage solution that offers unified management > Up to 160% more powerful than alternatives and 25% more efficient. > Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel