|
From: Sourav K. M. <sou...@gm...> - 2010-02-02 00:54:08
|
Hello,
(This is a different question for the same project that led me to file a
bug about alpha blending in "contour" .)
I want to overlay a number of exclusion regions in a 2D parameter scan.
I generate each region with contourf in succession, like:
contourf(x,y,unphys,(1),alpha=1,colors=('w','k'))
contourf(x,y,excl,(1),alpha=0.5,colors=('w','m'))
...
The problem as you might guess is that if I overlay many regions, the
white level at each new region washes out the underlying non-white
colors.
Is there a "transparent" color I can use instead of white? Or, is there
an alternative way to overlay regions that avoids this problem?
Thank you again!
Best,
Sourav
|
|
From: Eric F. <ef...@ha...> - 2010-02-02 01:23:37
|
Sourav K. Mandal wrote:
> Hello,
>
> (This is a different question for the same project that led me to file a
> bug about alpha blending in "contour" .)
>
> I want to overlay a number of exclusion regions in a 2D parameter scan.
> I generate each region with contourf in succession, like:
>
> contourf(x,y,unphys,(1),alpha=1,colors=('w','k'))
> contourf(x,y,excl,(1),alpha=0.5,colors=('w','m'))
> ...
>
> The problem as you might guess is that if I overlay many regions, the
> white level at each new region washes out the underlying non-white
> colors.
>
> Is there a "transparent" color I can use instead of white? Or, is there
> an alternative way to overlay regions that avoids this problem?
>
Until a grand reworking of the alpha mess occurs, here is a (verbose)
workaround showing how to set regions to be uncolored (transparent):
In [3]:cs = contourf(rand(10,10), colors=('r', 'g', 'b'))
In [4]:cs.levels
Out[4]:array([ 0. , 0.15, 0.3 , 0.45, 0.6 , 0.75, 0.9 , 1.05])
In [5]:cs.collections
Out[5]:<a list of 7 collections.PathCollection objects>
In [6]:cst = cs.collections[::3]
In [7]:for c in cst:
...: c.set_color('none')
...:
...:
In [8]:draw()
Alternatively, and more simply, why make the transparent regions in the
first place?
cs = contourf(rand(10,10), [0.5, 0.7], colors=('b'))
Here we specify a single pair of limits between which the color will be
blue.
Eric
|
|
From: Michael C. <mc...@ca...> - 2010-02-02 05:04:25
|
Hi all,
One of the most persistent problems I have with matplotlib is finding
out which kwargs and args are available for some commands.
For instance, I am looking at manipulating axis ticks and labels in
mplot3d, so I went to the mplot3d api page, and looked for useful
commands and found:
set_xlabel(xlabel, fontdict=None, **kwargs)¶
Set xlabel.
set_xlim3d(*args, **kwargs)¶
Set 3D x limits.
However, there is no information that I can find about "args" and
"kwargs" that I can use to figure out how to make my changes.
For the record, I want to be able to change the size of the font, the #
and values of the tick marks, and to move the axis labels to one or the
other end of the axis they are labelling.
Cheers
Michael
|
|
From: Sourav K. M. <sou...@gm...> - 2010-02-02 05:26:34
|
On Mon, 2010-02-01 at 15:23 -1000, Eric Firing wrote:
> Alternatively, and more simply, why make the transparent regions in the
> first place?
>
> cs = contourf(rand(10,10), [0.5, 0.7], colors=('b'))
>
> Here we specify a single pair of limits between which the color will be
> blue.
Well, that's embarrassing -- if I had read the documentation more
carefully, I would have realized that the levels spec "V" means
different things for "contour" and "contourf".
Thank you again! :)
Regards,
Sourav
|
|
From: Michael C. <mc...@ca...> - 2010-02-04 06:04:10
|
Can anyone help? Michael On 2/1/2010 9:04 PM, Michael Cohen wrote: > Hi all, > One of the most persistent problems I have with matplotlib is finding > out which kwargs and args are available for some commands. > For instance, I am looking at manipulating axis ticks and labels in > mplot3d, so I went to the mplot3d api page, and looked for useful > commands and found: > > set_xlabel(xlabel, fontdict=None, **kwargs)¶ > Set xlabel. > > set_xlim3d(*args, **kwargs)¶ > Set 3D x limits. > > However, there is no information that I can find about "args" and > "kwargs" that I can use to figure out how to make my changes. > > For the record, I want to be able to change the size of the font, the # > and values of the tick marks, and to move the axis labels to one or the > other end of the axis they are labelling. > > Cheers > Michael > > ------------------------------------------------------------------------------ > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Sourav K. M. <sou...@gm...> - 2010-02-04 10:02:46
|
On Wed, 2010-02-03 at 22:04 -0800, Michael Cohen wrote: > > One of the most persistent problems I have with matplotlib is finding > > out which kwargs and args are available for some commands. > > For instance, I am looking at manipulating axis ticks and labels in > > mplot3d, so I went to the mplot3d api page, and looked for useful > > commands and found: > > > > set_xlabel(xlabel, fontdict=None, **kwargs)¶ > > Set xlabel. > > > > set_xlim3d(*args, **kwargs)¶ > > Set 3D x limits. > > > > However, there is no information that I can find about "args" and > > "kwargs" that I can use to figure out how to make my changes. Don't these unbound methods just take the same arguments as the bound methods "xlabels" and "xlim", as given in http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.xlabel and http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.xlim ? |
|
From: Michael C. <mc...@ca...> - 2010-02-08 07:11:44
|
On 02/04/2010 02:02 AM, Sourav K. Mandal wrote: > On Wed, 2010-02-03 at 22:04 -0800, Michael Cohen wrote: > >>> One of the most persistent problems I have with matplotlib is finding >>> out which kwargs and args are available for some commands. >>> For instance, I am looking at manipulating axis ticks and labels in >>> mplot3d, so I went to the mplot3d api page, and looked for useful >>> commands and found: >>> >>> set_xlabel(xlabel, fontdict=None, **kwargs)¶ >>> Set xlabel. >>> >>> set_xlim3d(*args, **kwargs)¶ >>> Set 3D x limits. >>> >>> However, there is no information that I can find about "args" and >>> "kwargs" that I can use to figure out how to make my changes. > > Don't these unbound methods just take the same arguments as the bound > methods "xlabels" and "xlim", as given in > > http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.xlabel > > and > > http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.xlim > > ? > Ok, then I guess I am still not seeing how to accomplish what I'm looking to do. I have a yaxis which has ticks every 0.2, and I need it to be every 0.4. which function do I use to change that? Can I use that function to change the font size of the tick labels? It turns out there's an (undocumented) function called set_xticks in the mplot3d api (I deduced its existence from the existence of xticks in pyplot) but I'm not sure how to work it. I thought it would set the values to place the tickmarks at, so I tried: ax.set_xticks([-0.4,0.0,0.4,0.8]) but that just squashed up the plot. I also need to move the labels around on the 3d plot so they can be clearly seen in the figure. How can I tell the axis label where to be in reference to the axis itself? Cheers Michael |