[Matplotlib-users] colorbar+log+latex

2010-04-16 Thread Yves Revaz
Dear list,

I want to plot colored points using scatter, with the
color of points corresponding to the log of the z value of the points.

the corresponding scatter command is :

scatter(x,y,c=z,norm=colors.LogNorm())

unfortunately, then I then draw a colorbar simply calling

colorbar()

the fonts used for the color bar is no longer in latex mode,
as it was if I use a lin scale in scatter(), i.e., norm=None.


Is it a bug ?

Any solution ?

Thanks,

yves




-- 
 (o o)
oOO--(_)--OOo---
  Dr. Yves Revaz
  Laboratory of Astrophysics EPFL
  Observatoire de Sauverny Tel : ++ 41 22 379 24 28
  51. Ch. des Maillettes   Fax : ++ 41 22 379 22 05
  1290 Sauverny e-mail : yves.re...@epfl.ch
  SWITZERLAND  Web : http://www.lunix.ch/revaz/



--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] overflow...

2010-04-16 Thread Samuel Teixeira Santos
Hi all...

my code is that: http://dpaste.com/184551/

the problem is that code is using on an web app.

When I request the graph after press submit button
they generate the graph perfect

I do that for 6, 7 times with the same value to generate the graph
so after that the graph breaks, like if exceed the values to generate the
graph
and became a single line...


what I have to do to fix that?


thanks in advanced...


Samuel

p.s.: I note if I restart the application (like go to home of my web app and
restart the process to call the form to fill data and request the graph,
they fix, but when I request again with the form already filled before, they
break the graph on second request...
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] navigationtoolbar: 1. force location; 2. add select button(s) only

2010-04-16 Thread KrishnaPribadi

Hi, I'm trying to add some navigation tools to my mpl embedded in a wx app.

I noticed the default navigation tools here:
http://matplotlib.sourceforge.net/users/navigation_toolbar.html?highlight=matplotlib%20widgets
http://matplotlib.sourceforge.net/users/navigation_toolbar.html?highlight=matplotlib%20widgets
 
and am able to implement them using this example: 
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx2.html
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx2.html
.

However, I don't want to add the toolbar to the bottom of my canvas or to
any part of my canvas. I want to add the toolbar, or actually more
specifically, add the pan, zoom, and save buttons to a different panel and
sizer.

So far I tried adding the navigation toolbar to a different sizer, which is
on a different panel, but toolbar always shows up on the canvas.

Can someone suggest some methods on how to:
1. force and add the navigation toolbar to a different sizer or panel?
2. Add select buttons from the navigation toolbar to a different sizer or
panel than where the canvas is located?

Here is my example code:

#Boa:Frame:Frame1

import wx
import numpy as np
import matplotlib as mpl
mpl.use('WXAgg')
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from matplotlib.figure import Figure

def create(parent):
return Frame1(parent)

[wxID_FRAME1, wxID_FRAME1PANEL1, wxID_FRAME1PANEL2, 
] = [wx.NewId() for _init_ctrls in range(3)]

class Frame1(wx.Frame):
def _init_coll_bshPanels_Items(self, parent):
# generated method, don't edit

parent.AddWindow(self.panel1, 4, border=0, flag=wx.EXPAND)
parent.AddWindow(self.panel2, 1, border=0, flag=wx.EXPAND)

def _init_sizers(self):
# generated method, don't edit
self.bshPanels = wx.BoxSizer(orient=wx.HORIZONTAL)

self.bsvPanel1 = wx.BoxSizer(orient=wx.VERTICAL)

self.bsvPanel2 = wx.BoxSizer(orient=wx.VERTICAL)

self._init_coll_bshPanels_Items(self.bshPanels)

self.SetSizer(self.bshPanels)
self.panel1.SetSizer(self.bsvPanel1)
self.panel2.SetSizer(self.bsvPanel2)

def _init_ctrls(self, prnt):
# generated method, don't edit
wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
  pos=wx.Point(-870, 286), size=wx.Size(718, 547),
  style=wx.DEFAULT_FRAME_STYLE, title='Frame1')
self.SetClientSize(wx.Size(710, 520))

self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1',
parent=self,
  pos=wx.Point(0, 0), size=wx.Size(568, 520),
  style=wx.RAISED_BORDER | wx.TAB_TRAVERSAL)

self.panel2 = wx.Panel(id=wxID_FRAME1PANEL2, name='panel2',
parent=self,
  pos=wx.Point(568, 0), size=wx.Size(142, 520),
  style=wx.TAB_TRAVERSAL)

self._init_sizers()

def __init__(self, parent):
self._init_ctrls(parent)
self.InitCanvas()
self.AddToolBar()
self.AddToolBarBtns()

self.t = np.arange(0, np.pi*2, 0.01)
self.x = np.sin(2*np.pi*self.t)

self.myplot = self.ax.plot(self.t, self.x, 'b')
self.canvas.draw()


def InitCanvas(self):
self.fig = Figure(None)
self.canvas = FigureCanvasWxAgg(self.panel1, -1, self.fig)
self.bsvPanel1.Add(self.canvas, -1, wx.EXPAND)
##self.panel1.Fit()
self.ax = self.fig.add_subplot(111)
self.ax.grid('On')
return True

def AddToolBar(self):
self.toolbar = NavigationToolbar2Wx(self.canvas)
self.toolbar.Realize()
tw, th = self.toolbar.GetSizeTuple()
fw, fh = self.canvas.GetSizeTuple()
self.toolbar.SetSize(wx.Size(fw, th))

#Trying to add to different sizer than to whom the canvas belongs
self.bsvPanel2.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
#but this doesn't work. The toolbar is still on the canvas,
#but disapears as soon as I resize or do a redraw.

#Need correct code here, please.


self.toolbar.update()
return True

def AddToolBarBtns(self):
'''add specific tool buttons from the navigatio toolbar to panel2'''
#need code here, if possible

pass


if __name__ == '__main__':
app = wx.PySimpleApp()
frame = create(None)
frame.Show()

app.MainLoop()


-
Krishna Adrianto Pribadi
Test Engineer
Harley-Davidson Motor Co.
Talladega Test Facility
Vehicle Test Stands
-- 
View this message in context: 
http://old.nabble.com/navigationtoolbar%3A-1.-force-location--2.-add-select-button%28s%29-only-tp28268828p28268828.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Download Intel#174; Parallel Studio Eval
Try the new software 

Re: [Matplotlib-users] possible to specify RGB in set_under or set_over?

2010-04-16 Thread Matthias Michler
On Friday 16 April 2010 16:49:05 Dr. Phillip M. Feldman wrote:
 I would like to specify the colors to be used for plotting out-of-range
 values via RGB triples rather than color name strings.  Is this possible?

With matplotlib-svn it works for me.
What version of mpl are you using?

Kind regards,
Matthias

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] savefig Memory Leak

2010-04-16 Thread Keegan Callin

Hello,

I have written a small script that, I think, demonstrates a memory leak 
in savefig.  A search of the mailing list shows a thread started by Ralf 
Gommers ralf.gomm...@googlemail.com about 2009-07-01 that seems to 
cover a very similar issue.  I have appended the demonstration script at 
the end of this e-mail text.


The demonstration script script sits in a relatively tight loop creating 
figures then saving them while monitoring memory usage.  A plot of VmRSS 
vs. number of loop iterations as generated on my system is attached as 
data.png (you can create your own plots with the sample script).  
Although I have only tested this on Fedora 12, I expect that most Linux 
users should be able to run the script for themselves.  Users should be 
able to comment out the savefig line and watch memory usage go from 
unbounded to (relatively) bounded.


Can anybody see a cause for this leak hidden in my code?  Has anybody 
seen this issue and solved it?  I would also appreciate it if other 
people would run this script and report their findings so that there 
will be some indication of the problem's manifestation frequency.


Sincerely,
Keegan Callin




'''Script to demonstrate memory leakage in savefig call.

Requirements:
Tested in Fedora 12.  It should work on other systems where
/proc/{PID}/status files exist and those files contain a 'VmRSS' entry
(this is how the script monitors its memory usage).

System Details on Original Test System:

[kee...@grizzly test]$ uname -a
Linux grizzly 2.6.32.9-70.fc12.x86_64 #1 SMP Wed Mar 3 04:40:41 UTC 2010 
x86_64 x86_64 x86_64 GNU/Linux


[kee...@grizzly ~]$ gcc --version
gcc (GCC) 4.4.3 20100127 (Red Hat 4.4.3-4)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[kee...@grizzly ~]$ cd ~/src/matplotlib-0.99.1.1
[kee...@grizzly matplotlib-0.99.1.1]$ rm -rf build
[kee...@grizzly matplotlib-0.99.1.1]$ python setup.py build  out.log
[kee...@grizzly matplotlib-0.99.1.1]$ head -38 out.log

BUILDING MATPLOTLIB
matplotlib: 0.99.1.1
python: 2.6.4 (r264:75706, Jan 20 2010, 12:34:05)  [GCC
4.4.2 20091222 (Red Hat 4.4.2-20)]
  platform: linux2

REQUIRED DEPENDENCIES
 numpy: 1.4.0
 freetype2: 9.22.3

OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.43
   Tkinter: no
* TKAgg requires Tkinter
  wxPython: no
* wxPython not found
  Gtk+: no
* Building for Gtk+ requires pygtk; you must be 
able

* to import gtk in your build/install environment
   Mac OS X native: no
Qt: no
   Qt4: no
 Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
  datetime: present, version unknown
  dateutil: matplotlib will provide
  pytz: 2010b

OPTIONAL USETEX DEPENDENCIES
dvipng: no
   ghostscript: 8.71
 latex: no
   pdftops: 0.12.4

[Edit setup.cfg to suppress the above messages]

[kee...@grizzly matplotlib-0.99.1.1]$ bzip2 out.log
# out.log.bz2 is attached to the message containing this program.

[kee...@grizzly ~]$ python2.6
Python 2.6.4 (r264:75706, Jan 20 2010, 12:34:05)
[GCC 4.4.2 20091222 (Red Hat 4.4.2-20)] on linux2
Type help, copyright, credits or license for more information.
 import matplotlib
 matplotlib.__version__
'0.99.1.1'
'''
# Import standard python modules
import sys
import os
from ConfigParser import SafeConfigParser as ConfigParser
from cStringIO import StringIO

# import numpy
import numpy
from numpy import zeros

# Import matplotlib
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas


def build_figure(a):
'''Returns a new figure containing array a.'''

# Create figure and setup graph
fig = Figure()
FigureCanvas(fig)
ax = fig.add_subplot(1, 1, 1)
ax.plot(a)

return fig


_proc_status = '/proc/%d/status' % os.getpid()
def load_status():
'''Returns a dict of process statistics from from 
/proc/{PID}/status.'''

status = {}

with open(_proc_status) as f:
for line in f:
key, value = line.split(':', 1)
key = key.strip()
value = value.strip()
status[key] = value

return status


def main():
data_file = 'data.txt'
image_file = 'data.png'
num_iterations = 1000

with open(data_file, 'w') as f:
# Tried running without matplotlib or numpy such that the
# 

Re: [Matplotlib-users] How to overlay an image on a multi plot? (Edit: how to plot sparklines on an existing plot)

2010-04-16 Thread Josh Hemann

OK, I am finally posting some code. The graphic it will produce is similar to
above. I mocked up some time series data and fit one of the regression lines
using PyIMSL Studio (Scipy for the other one). Full disclosure: I am on the
PyIMSL Studio team at Rogue Wave Software. You can use PyIMSL Studio for
free for noncommercial use, and you can choose to install just the
math/stat/data libraries under site-packages like any other Python package.
But, as for the matplotlib calls themselves, hopefully the code is clear and
a useful example.

Cheers.


http://old.nabble.com/file/p28272259/matplotlib_gallery_scatter.py
matplotlib_gallery_scatter.py 

-
Josh Hemann
Statistical Advisor 
http://www.roguewave.com//; Rogue Wave Software 
jhemann at vni dizzot com 

-- 
View this message in context: 
http://old.nabble.com/How-to-overlay-an-image-on-a-multi-plot--tp28111498p28272259.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Embedding an MPL Canvas/Figure in a PyGTK Container

2010-04-16 Thread Vamsi Vytla
Adding line:
ax.set_xlabel(asdf)

To file (matplotlib examples):
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_gtk2.py

This sets the X-Label under the navigation toolbar.  I am unable to set it
such a way that the entire canvas is rendered in the container.

It would be of great help to know how this can be done.

Thanks,
W
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users