2010/3/30 Chloe Lewis :
> But this example doesn't solve the problem I was thinking of: it shows lots
> of colors in the colorbar that aren't used in the plot.
I'm so stupid! Here is the correct code. I just interchanged
"-bounds, bound" with "min_val, max_val" on line 28. The only thing I
didn
On Tue, Mar 30, 2010 at 11:15 AM, Chloe Lewis wrote:
> But this example doesn't solve the problem I was thinking of: it shows
> lots of colors in the colorbar that aren't used in the plot.
Here's a patch (and example) that I've cooked up that adds a
colorbar.set_limits() method. It works pretty
But this example doesn't solve the problem I was thinking of: it shows
lots of colors in the colorbar that aren't used in the plot.
&C
On Mar 30, 2010, at 6:52 AM, Friedrich Romstedt wrote:
> 2010/3/30 Ariel Rokem :
>> I ended up with the code below, using Chloe's previously posted
>> 'subc
Hi Friedrich,
Thanks a lot - very nice!
Cheers - Ariel
On Tue, Mar 30, 2010 at 6:52 AM, Friedrich Romstedt <
friedrichromst...@gmail.com> wrote:
> 2010/3/30 Ariel Rokem :
> > I ended up with the code below, using Chloe's previously posted
> > 'subcolormap' and, in order to make the colorbar nic
2010/3/30 Ariel Rokem :
> I ended up with the code below, using Chloe's previously posted
> 'subcolormap' and, in order to make the colorbar nicely attached to the main
> imshow plot, I use make_axes_locatable in order to generate the colorbar
> axes. I tried it out with a couple of use-cases and i
Hi -
I ended up with the code below, using Chloe's previously posted
'subcolormap' and, in order to make the colorbar nicely attached to the main
imshow plot, I use make_axes_locatable in order to generate the colorbar
axes. I tried it out with a couple of use-cases and it seems to do what it
is s
2010/3/29 Friedrich Romstedt :
> Note that the ticking is a bit weird, there is also a bug in
> matplotlib I will report on right after this e-mail, whose bugfix you
> will maybe want to apply to get ticking properly working. When you
> have insane values for C.min() and C.max() anyway, I'm afraid
I once had a similar issue. I solved it like this. It takes the minimum and
maximum of the data and returns a colormap: Zero: White, Positive values:
blue, Negative values: red.
def mxcmap(_min,_max):
if _min >= 0 and _max >= 0:
cdict = {'red': ((0.0, 1.0, 1.0),
2010/3/28 Chloe Lewis :
> That would be a lot nicer, Friedrich; could you share demo code? I can't
> make the set_ylim work, but I think I'm being clumsy with the object model.
It seems that I cannot read the sections following after the "From
this:" and "I get this:"?
But anyway, I solved it fo
2010/3/28 Ariel Rokem :
> Hi Chloe,
>
> _segmentdata - that's what I was looking for!
Hmm, much easier would maybe be:
colorbar = figure.colorbar(...)
colorbar.ax.set_xlim((C.min(), C.max()) # Or .set_ylim() for vertical cbars.
I just did a dive into the matplotlib code and docu:
http://matplo
Hi Chloe,
_segmentdata - that's what I was looking for!
Thanks a lot also for that bit of code!
Cheers - Ariel
On Sun, Mar 28, 2010 at 1:53 AM, Chloe Lewis wrote:
> Like so, not that it couldn't be improved:
>
> import matplotlib.cm as cm
> import matplotlib.colors as colors
> import pylab
Like so, not that it couldn't be improved:
import matplotlib.cm as cm
import matplotlib.colors as colors
import pylab as p
def rgb_to_dict(value, cbar):
return dict(zip(('red','green','blue','alpha'), cbar(value)))
def subcolorbar(xmin, xmax, cbar):
'''Returns the part of cbar between
To zoom in on the relevant section of a colorbar -- I convinced myself
once that I'd need an auxiliary function to define a new cdict that
covers only the current section of the original cdict. (and then
define a new colorbar from the cdict, and maybe do a little norming of
the data).
_seg
Hi Friedrich,
Thanks a lot for your response. I think that you are right - using the
vmin/vmax args into imshow (as well as into pcolor) does seem to do what I
want. Great!
The only thing that remains now is to simultaneously stretch the colormap in
the image itself to this range, while also rest
2010/3/27 Ariel Rokem :
> I am trying to make a color-map which will respond to the range of values in
> the data itself. That is - I want to take one of the mpl colormaps and use
> parts of it, depending on the range of the data.
>
> In particular, I am interested in using the plt.cm.RdYlBu_r colo
Hi Brian,
Thanks for the code - this is definitely in the direction of what I want to
make!
The RdYlBu_r colormap is one of the built-in colormaps available in
matplotlib.pyplot.cm (you can see all of them here:
http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps). I think that using
the buil
On Mar 27, 2010, at 1:13 , Ariel Rokem wrote:
In particular, I am interested in using the plt.cm.RdYlBu_r
colormap. If the data has both negative and positive values, I want
0 to map to the central value of this colormap (a pale whitish
yellow) and I want negative values to be in blue and p
Hi everyone,
I am trying to make a color-map which will respond to the range of values in
the data itself. That is - I want to take one of the mpl colormaps and use
parts of it, depending on the range of the data.
In particular, I am interested in using the plt.cm.RdYlBu_r colormap. If the
data h
18 matches
Mail list logo