Re: [Matplotlib-users] how to make a colorbar starting with a different color?

2013-07-03 Thread ChaoYue
Thanks Ben. extendrect keyword is in mat 1.3, I didn't try this but I tried
set_under and extend='min'
with mat 1.2 and it works very nice.

cheers,

Chao

On Tue, Jul 2, 2013 at 4:14 PM, Benjamin Root-2 [via matplotlib] <
[email protected]> wrote:

> There is the "set_over" and "set_under" members of a colormap, and the
> plt.colorbar() function takes an "extend='min'" argument to add an extra
> color at the beginning of the colorbar. Setting "extendrect=True", the
> added color will be rectangular instead of triangular.
>
> Hopefully that helps.
>
> Cheers,
> Ben Root
>
>
>
> On Tue, Jul 2, 2013 at 6:14 AM, Chao YUE <[hidden 
> email]
> > wrote:
>
>> One way I could think of is to make two contingent mat.axes.Axes,
>> with a smaller one setting as white backgroud, and the other bigger on
>> holding the colorbar. Is there some better way?
>>
>> Chao
>>
>>
>> On Tue, Jul 2, 2013 at 12:12 PM, Chao YUE <[hidden 
>> email]
>> > wrote:
>>
>>> Dear all,
>>>
>>> Does anyone have similar experience that to make a colorbar
>>> starting from a different color in the colormap? for example, to
>>> denote the region with invalid data. I attahced a figure to show
>>> what I would like to have, the withe region in the colorbar in the
>>> attahced figure shows no data.
>>>
>>> thanks a lot for any help,
>>>
>>> best,
>>>
>>> Chao
>>>
>>> --
>>>
>>> ***
>>> Chao YUE
>>> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
>>> UMR 1572 CEA-CNRS-UVSQ
>>> Batiment 712 - Pe 119
>>> 91191 GIF Sur YVETTE Cedex
>>> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
>>>
>>> 
>>>
>>
>>
>>
>> --
>>
>> ***
>> Chao YUE
>> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
>> UMR 1572 CEA-CNRS-UVSQ
>> Batiment 712 - Pe 119
>> 91191 GIF Sur YVETTE Cedex
>> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
>>
>> 
>>
>>
>> --
>> This SF.net email is sponsored by Windows:
>>
>> Build for Windows Store.
>>
>> http://p.sf.net/sfu/windows-dev2dev
>> ___
>> Matplotlib-users mailing list
>> [hidden email] 
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
> --
>
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> ___
> Matplotlib-users mailing list
> [hidden email] 
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://matplotlib.1069221.n5.nabble.com/how-to-make-a-colorbar-starting-with-a-different-color-tp41362p41364.html
>  To start a new topic under matplotlib - users, email
> [email protected]
> To unsubscribe from matplotlib, click 
> here
> .
> NAML
>



-- 
***
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/how-to-make-a-colorbar-starting-with-a-different-color-tp41362p41383.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mat

Re: [Matplotlib-users] quickly return colorbar ticks?

2013-07-03 Thread ChaoYue
Thanks Ben. I tried but still confused.

In [8]: fig,ax = plt.subplots()

In [9]: ax.plot(range(100))
Out[9]: []

In [10]: ax.get_xticks()
Out[10]: array([   0.,   20.,   40.,   60.,   80.,  100.])

In [11]: ax.get_yticks()
Out[11]: array([   0.,   20.,   40.,   60.,   80.,  100.])

In [12]: draw()

In [13]: cs = ax.imshow(np.arange(100).reshape(10,10))

In [14]: draw()

In [15]: cbar = plt.colorbar(cs,ticks=np.arange(0,100,10))

In [16]: cbar.ax.get_yticks()
Out[16]:
array([ 0.,  0.1010101 ,  0.2020202 ,  0.3030303 ,  0.4040404 ,
0.50505051,  0.60606061,  0.70707071,  0.80808081,  0.90909091])

there are many methods avaialbe for cbar.ax.yaxis object:
In [19]: cbar.ax.yaxis.get*tick*?
cbar.ax.yaxis.get_major_ticks
cbar.ax.yaxis.get_majorticklabels
cbar.ax.yaxis.get_majorticklines
cbar.ax.yaxis.get_majorticklocs
cbar.ax.yaxis.get_minor_ticks
cbar.ax.yaxis.get_minorticklabels
cbar.ax.yaxis.get_minorticklines
cbar.ax.yaxis.get_minorticklocs
cbar.ax.yaxis.get_ticklabel_extents
cbar.ax.yaxis.get_ticklabels
cbar.ax.yaxis.get_ticklines
cbar.ax.yaxis.get_ticklocs
cbar.ax.yaxis.get_ticks_position

I tried
In [20]: cbar.ax.yaxis.get_majorticklocs()
Out[20]:
array([ 0.,  0.1010101 ,  0.2020202 ,  0.3030303 ,  0.4040404 ,
0.50505051,  0.60606061,  0.70707071,  0.80808081,  0.90909091])

But it doesn't give the tick locs as the normal axes?

could you explain a bit further?

thanks et cheers,

Chao



On Tue, Jul 2, 2013 at 4:17 PM, Benjamin Root-2 [via matplotlib] <
[email protected]> wrote:

> This is a constant source of confusion.  The colorbar object should be
> thought of as just another subaxes.  To get the ticks, you want the ticks
> from the colorbar's yaxis or xaxis object accordingly.  Of course, I could
> have sworn we added a helper function for this at some point, but I could
> be wrong.
>
> I hope that helps!
> Ben Root
>
>
> On Tue, Jul 2, 2013 at 5:43 AM, Chao YUE <[hidden 
> email]
> > wrote:
>
>> Dear all matplotlib users,
>>
>> I found there is not a get_ticks method available for colorbar instance,
>> how could I quick get the ticks of a colorbar?
>>
>> thanks,
>>
>> Chao
>> --
>>
>> ***
>> Chao YUE
>> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
>> UMR 1572 CEA-CNRS-UVSQ
>> Batiment 712 - Pe 119
>> 91191 GIF Sur YVETTE Cedex
>> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
>>
>> 
>>
>>
>> --
>> This SF.net email is sponsored by Windows:
>>
>> Build for Windows Store.
>>
>> http://p.sf.net/sfu/windows-dev2dev
>> ___
>> Matplotlib-users mailing list
>> [hidden email] 
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
> --
>
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> ___
> Matplotlib-users mailing list
> [hidden email] 
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://matplotlib.1069221.n5.nabble.com/quickly-return-colorbar-ticks-tp41361p41365.html
>  To start a new topic under matplotlib - users, email
> [email protected]
> To unsubscribe from matplotlib, click 
> here
> .
> NAML
>



-- 
***
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/quickly-return-colorbar-ticks-tp41361p41384.html
Sent from the matplotlib - users mailing list archive at Nabble.com.--

Re: [Matplotlib-users] quickly return colorbar ticks?

2013-07-03 Thread Benjamin Root
On Wed, Jul 3, 2013 at 3:13 AM, ChaoYue  wrote:

> Thanks Ben. I tried but still confused.
>
> In [8]: fig,ax = plt.subplots()
>
> In [9]: ax.plot(range(100))
> Out[9]: []
>
> In [10]: ax.get_xticks()
> Out[10]: array([   0.,   20.,   40.,   60.,   80.,  100.])
>
> In [11]: ax.get_yticks()
> Out[11]: array([   0.,   20.,   40.,   60.,   80.,  100.])
>
> In [12]: draw()
>
> In [13]: cs = ax.imshow(np.arange(100).reshape(10,10))
>
> In [14]: draw()
>
> In [15]: cbar = plt.colorbar(cs,ticks=np.arange(0,100,10))
>
> In [16]: cbar.ax.get_yticks()
> Out[16]:
> array([ 0.,  0.1010101 ,  0.2020202 ,  0.3030303 ,  0.4040404 ,
> 0.50505051,  0.60606061,  0.70707071,  0.80808081,  0.90909091])
>
> there are many methods avaialbe for cbar.ax.yaxis object:
> In [19]: cbar.ax.yaxis.get*tick*?
> cbar.ax.yaxis.get_major_ticks
> cbar.ax.yaxis.get_majorticklabels
> cbar.ax.yaxis.get_majorticklines
> cbar.ax.yaxis.get_majorticklocs
> cbar.ax.yaxis.get_minor_ticks
> cbar.ax.yaxis.get_minorticklabels
> cbar.ax.yaxis.get_minorticklines
> cbar.ax.yaxis.get_minorticklocs
> cbar.ax.yaxis.get_ticklabel_extents
> cbar.ax.yaxis.get_ticklabels
> cbar.ax.yaxis.get_ticklines
> cbar.ax.yaxis.get_ticklocs
> cbar.ax.yaxis.get_ticks_position
>
> I tried
> In [20]: cbar.ax.yaxis.get_majorticklocs()
> Out[20]:
> array([ 0.,  0.1010101 ,  0.2020202 ,  0.3030303 ,  0.4040404 ,
> 0.50505051,  0.60606061,  0.70707071,  0.80808081,  0.90909091])
>
> But it doesn't give the tick locs as the normal axes?
>
> could you explain a bit further?
>
> thanks et cheers,
>
> Chao
>
>
Remember, there is a difference between a tick location, and a tick label.
A colormap works from 0 to 1, so that is its data coordinates.  We merely
label the ticks with the appropriate values.  Try
cbar.ax.yaxis.get_ticklabels().

Cheers!
Ben Root
--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] xlabel cropped

2013-07-03 Thread Florian Lindner
Hello!

I have that snipped to create a plot:

import matplotlib.pyplot as plt
size = (6.1, 3.5)
fig = plt.figure(figsize=size)
plt.xlabel("$x/l_F$")

it's being saved as eps for latex. At the size given the "F" from l_F is 
truncated just a little bit. It works well if I change y-size to 3.6 but that 
makes latex place to figure on a seperate page which I do not want.

Is this behavior by design or a bug? How can I give just 0.1 more y-space to 
the xlabel without altering the overall size?

Thanks,
Florian

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xlabel cropped

2013-07-03 Thread Florian Lindner
Am Mittwoch, 3. Juli 2013, 20:02:30 schrieb Florian Lindner:
> Hello!
> 
> I have that snipped to create a plot:
> 
> import matplotlib.pyplot as plt
> size = (6.1, 3.5)
> fig = plt.figure(figsize=size)
> plt.xlabel("$x/l_F$")
> 
> it's being saved as eps for latex. At the size given the "F" from l_F is
> truncated just a little bit. It works well if I change y-size to 3.6 but
> that makes latex place to figure on a seperate page which I do not want.
> 
> Is this behavior by design or a bug? How can I give just 0.1 more y-space to
> the xlabel without altering the overall size?

Ok, I should have read to docu before googling.

plt.xlabel("$x/l_F$", labelpad = -0.1)
did it.

Sorry for bothering...

Florian

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xlabel cropped

2013-07-03 Thread Benjamin Root
Not a bother.  This is a fairly common problem because matplotlib, by
design, does not handle layouts for you. If you are looking for an
automated way of handling this, there is plt.tight_layout(), which is a
feature that was added in v1.2, IIRC, that tries adjusting certain spacing
and size parameters automatically in an effort to keep everything inside
the figure space. However, a solution like yours is often perfered because
it gives you explicit control over the plot, and is guaranteed to work the
same way, every time.

Cheers!
Ben Root


On Wed, Jul 3, 2013 at 2:08 PM, Florian Lindner  wrote:

> Am Mittwoch, 3. Juli 2013, 20:02:30 schrieb Florian Lindner:
> > Hello!
> >
> > I have that snipped to create a plot:
> >
> > import matplotlib.pyplot as plt
> > size = (6.1, 3.5)
> > fig = plt.figure(figsize=size)
> > plt.xlabel("$x/l_F$")
> >
> > it's being saved as eps for latex. At the size given the "F" from l_F is
> > truncated just a little bit. It works well if I change y-size to 3.6 but
> > that makes latex place to figure on a seperate page which I do not want.
> >
> > Is this behavior by design or a bug? How can I give just 0.1 more
> y-space to
> > the xlabel without altering the overall size?
>
> Ok, I should have read to docu before googling.
>
> plt.xlabel("$x/l_F$", labelpad = -0.1)
> did it.
>
> Sorry for bothering...
>
> Florian
>
>
> --
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Reports from SciPy 2013

2013-07-03 Thread Damon McDougall
On Tue, Jul 2, 2013 at 11:57 PM, Nelle Varoquaux
wrote:

> On 2 July 2013 16:33, Anthony Scopatz  wrote:
> >
> > On Tue, Jul 2, 2013 at 9:04 AM, Jason Grout  >
> > wrote:
> >>
> >> On 7/1/13 9:33 AM, Michael Droettboom wrote:
> >> > SciPy 2013 was a great success.  I didn't get good headcount at the
> >> > matplotlib BOF, but it was a good number, and we had 15 participants
> at
> >> > various points during the sprints.  It was nice to see the diversity
> of
> >> > experience with matplotlib at the sprints, and I hope we oldtimers
> were
> >> > helpful to the newtimers getting started so they can continue to
> >> > contribute in the future.  It was also great to put some faces to many
> >> > of the talented names I've been seeing on github and the mailing list
> >> > lately.
> >> >
> >>
> >> On a slightly different, but related topic: is there any chance the
> >> entries (or at least the winning entries) to the plotting contest could
> >> be posted online?
> >
> >
> > Yes, We'll put try to put these on the conference website at the very
> least.
>
> We also talked about adding this to the matplotlib website, but we
> need to sort out first the copyright problems and then coding this
> part of the website.
>

+1

-- 
Damon McDougall
http://www.damon-is-a-geek.com
Institute for Computational Engineering Sciences
201 E. 24th St.
Stop C0200
The University of Texas at Austin
Austin, TX 78712-1229
--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] v.0.99.1.1 DeprecationWarning: Use the new widget gtk.Tooltip() self.tooltips = gtk.Tooltips()

2013-07-03 Thread David Jonathan Pryce Morris
I am new to python and when using Matplotlib 0.99.1.1 [Scientific Linux
6.3, Python 2.6] to plot I get the following error:

/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py:621: 
DeprecationWarning: Use the new widget gtk.Tooltip
  self.tooltips = gtk.Tooltips()

This is when the program reaches:

plt.show()

Where plt is the matplotlib.pyplot. Prior to this point of the code I am
able to produce pdf files of the figure by using plt.savefig(fname).

Reading other online comments I have tried to update Matplotlib. First I
installed the dependences via

sudo yum-builddep python-matplotlib

Then:

sudo yum install matplotlib

This then tells me that I have the latest version of matplotlib and
therefore does nothing. There are more recent versions available from
the Matplotlib website. I tried to install the latest version after
unpacking the tar.gz file. After using the command:

sudo python setup.py install

I get the message below ending with error: 

command 'gcc' failed with exit status 1

Can anyone suggest a way to install the latest matplotlib or stop the
message I get with using plt.show()?

Jonathan





basedirlist is: ['/usr/local', '/usr', 'usr/lib64']

BUILDING MATPLOTLIB
matplotlib: 1.2.1
python: 2.6.6 (r266:84292, Jun 18 2012, 09:57:52)  [GCC
4.4.6 20110731 (Red Hat 4.4.6-3)]
  platform: linux2

REQUIRED DEPENDENCIES
 numpy: 1.4.1
 freetype2: 9.22.3

OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.49
   Tkinter: Tkinter: 73770, Tk: 8.5, Tcl: 8.5
* Guessing the library and include directories
for
* Tcl and Tk because the tclConfig.sh and
* tkConfig.sh could not be found and/or parsed.
  Gtk+: gtk+: 2.18.9, glib: 2.22.5, pygtk: 2.16.0,
pygobject: 2.20.0
   Mac OS X native: no
Qt: no
   Qt4: Qt: 4.6.2, PyQt4: 4.7.4
PySide: no
 Cairo: 1.8.6

OPTIONAL DATE/TIMEZONE DEPENDENCIES
  dateutil: 1.4.1
  pytz: 2010h

OPTIONAL USETEX DEPENDENCIES
dvipng: no
   ghostscript: 8.70
 latex: 3.141592
   pdftops: 0.12.4

[Edit setup.cfg to suppress the above messages]

pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends',
'matplotlib.backends.qt4_editor', 'matplotlib.projections',
'matplotlib.testing', 'matplotlib.testing.jpl_units',
'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d',
'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1',
'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.tri',
'matplotlib.delaunay']
running install
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc ->
build/lib.linux-x86_64-2.6/matplotlib/mpl-data
running build_ext
building 'matplotlib.backends._backend_agg' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC
-fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic
-D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API
-DPYCXX_ISO_CPP_LIB=1 -I/usr/local/include -I/usr/include
-Iusr/lib64/include -Iusr/lib64/python2.6/include
-Iusr/lib64/python2.6/site-packages/include
-I/usr/lib64/python2.6/site-packages/numpy/core/include
-I/usr/local/include -I/usr/include -I.
-I/usr/lib64/python2.6/site-packages/numpy/core/include -Isrc
-Iagg24/include -I.
-I/usr/lib64/python2.6/site-packages/numpy/core/include
-I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I.
-I/usr/include/python2.6 -c agg24/src/agg_trans_affine.cpp -o
build/temp.linux-x86_64-2.6/agg24/src/agg_trans_affine.o
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC
-fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic
-D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API
-DPYCXX_ISO_CPP_LIB=1 -I/usr/local/include -I/usr/include
-Iusr/lib64/include -Iusr/lib64/python2.6/include
-Iusr/lib64/python2.6/site-packages/include
-I/usr/lib64/python2.6/site-packages/numpy/core/include
-I/usr/local/include -I/usr/include -I.
-I/usr/lib64/python2.6/site-packages/numpy/core/include -Isrc
-Iagg24/include -I.
-I/usr/lib64/python2.6/site-packages/numpy/core/include
-I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I.
-I/usr/include/python2.6 

[Matplotlib-users] Smooth animations

2013-07-03 Thread v0idnull
I am receiving a number from a server every two seconds. I would like to plot 
this number.out over time for the past say... 30 polls.

Would it be possible to use... Anything, to produce a smooth animation of the 
plot line getting drawn? As it stands now the animation is well... Quite 
choppy. ;)

I'm using pygame currently to render my graphs on this full screen application 
I'm making just for my self. I am not bound to it though if there are better 
linux-only things out there.

Thanks in advance,
--alex--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users