Re: [Matplotlib-users] jitter in matplotlib?

2011-02-24 Thread gary ruben
I haven't seen this done before so I don't know if there's a standard
way. The idea seems to be to take some points which are real data,
create a random variable for each point with the points' position as
the mean, then choose some number of points from each distribution to
create some new points clustered around the original data. Some
examples online seem to use uniform distributions and Poisson
distributions or mixtures of these (uniform for the x-variable and
Poisson for the y). If my take on this is correct, you can use
scipy.stats to do this - an example is in the attached file which
creates Gaussian distributions for each of the x and y coordinates
then creates an equal number of new points for each of the seed
points. The online examples I saw seem to choose random numbers of new
points for each seed point. I didn't bother trying to cover all the
possibilities. Hopefully this is helpful,

Gary R.

On Thu, Feb 24, 2011 at 3:04 PM, Uri Laserson laser...@mit.edu wrote:
 Hi all,
 I am interested in jittering points in a plot.  I searched the forum, but I
 am amazed at the dearth of results on the topic.  I am referring to
 something like this:
 http://goo.gl/Db47s
 or
 http://goo.gl/BjIZt

 Is there a standard way people do this with MPL?
 Thanks!
 Uri
 ...
 Uri Laserson
 Graduate Student, Biomedical Engineering
 Harvard-MIT Division of Health Sciences and Technology
 M +1 917 742 8019
 laser...@mit.edu


jitter.py
Description: Binary data
--
Free Software Download: Index, Search  Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev ___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib Widget and QT Issue

2011-02-24 Thread Nadezhda Dencheva
Jason,

Try adding a pyqt property 'facecolor' to your widget.
(This way you can set it also through the designer.)

Add something like this to the widget's __init__ method:

figFacecolor = QtCore.pyqtProperty(str, getfigfacecolor,
setfigfacecolor, resetfigfacecolor)

And then define the three methods.

Nadia
--
Free Software Download: Index, Search  Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev ___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] HTML Link in Text

2011-02-24 Thread Benjamin Root
On Wed, Feb 23, 2011 at 10:52 PM, Mark Janikas mjani...@esri.com wrote:

  Hello All,



 Is there a way to add HTML links into output graphics?  In short, I would
 like to use something like the PLT.text command and have it link to an html
 page.  The url arg doesn’t seem to be what I am looking for.



 My final output medium is PDF… so I am using:



 from matplotlib.backends.backend_pdf import PdfPages as PDF

 import matplotlib.pyplot as PLT





 pdfOutput = PDF(fileName)

 PLT.text(“Some Text to Link”, url = “http:…”)

 …

 …

 PLT.savefig(pdfOutput, format='pdf')

 PLT.clf()





 Thanks so much for any advise!



 MJ


Looks like the url string is only used for SVG files.  If you could, please
file a feature request to have it added to the pdf backend:

https://sourceforge.net/tracker/?group_id=80706

Ben Root
--
Free Software Download: Index, Search  Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev ___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] figure window coordinates

2011-02-24 Thread Benjamin Root
On Wed, Feb 23, 2011 at 6:56 PM, Jack Sankey jack.san...@gmail.com wrote:

 Hi everyone!

 Is there any backend-independent way to get and set the figure window
 coordinates and sizes (i.e. in pixels)? Currently when I make new plots they
 appear in random locations as determined by my operating system; during
 analysis when I'm making and destroying a lot of plot windows I want to be
 able to have them automatically appear in good locations (such as the
 upper left corner of my screen).

 Also, I am trying to find ways to get/set the z-order.

 Thanks in advance,
 Jack


There was someone who found that it was possible to add some additional
information to the creation of a figure window.  This information (at least
on Linux systems), could be taken advantage of by customized configurations
of the desktop manager.  I would be curious to see what has come of that
effort.

Ben Root
--
Free Software Download: Index, Search  Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev ___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Histogram with single series - colour coding different ranges?

2011-02-24 Thread Goyo
2011/2/22 Benjamin Root ben.r...@ou.edu:

 Admittedly, this isn't using matplotlib's hist() function because it only
 allows for one color per dataset.  However, you can use numpy's histogram
 function to get the bins and counts yourself, and then use bar() to make the
 bars.  bar() will allow you to color the bars individually.

Pylab hist() returns a list of patches so you can also change their properties.

Goyo

--
Free Software Download: Index, Search  Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] 64bit installer

2011-02-24 Thread Tommy Grav
Is there a 64bit installer of matplotlib for mac os x available?

Cheers
  Tommy

--
Free Software Download: Index, Search  Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] faq: reducing figure.figsize cuts off labels and tick marks

2011-02-24 Thread Darren Dale
On Tue, Feb 22, 2011 at 4:23 AM, Daniel Mader
danielstefanma...@googlemail.com wrote:
 Hi,

 there has been a similar question recently but I couldn't figure out
 if or how this is solved:

 I'd like to reduce the figure size so that I can add it to a LaTeX
 document without scaling (PDF output with LaTeX font rendering). For
 that, I need to adapt the font sizes, too.

 Unfortunately, the canvas is not properly scaled so that the axis
 labels and the possibly the tick marks are cut off.

 Is this a bug, feature, design flaw? How can I properly work around
 it, i.e. reduce the graph automatically for a given figsize/font size
 combination so that everything fits on the figure?

 An example follows to demonstrate, thanks in advance

I use matplotlib for this purpose pretty frequently. A few tricks:

from http://matplotlib.sourceforge.net/users/customizing.html :
# note that font.size controls default text sizes.  To configure
# special text sizes tick labels, axes, labels, title, etc, see the rc
# settings for axes and ticks. Special text sizes can be defined
# relative to font.size, using the following values: xx-small, x-small,
# small, medium, large, x-large, xx-large, larger, or smaller

# specify the figure canvas size, in inches
figure(figsize=(3.4, 4))

# place the axes in the figure window
# specifying (left, bottom, width, height) as fraction of figure size
# adjust those positions to make enough room for tick and axis labels
axes([0.15, 0.12, 0.8, 0.83])

Specify the dpi for you screen, so the figure rendered on your screen
is the correct size. This is figure.dpi, best to set it in
matplotlibrc.

Darren

--
Free Software Download: Index, Search  Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Qt integration and sip API

2011-02-24 Thread Michele Mattioni
Following up, after a bit of research...

It seems it's alla about QString (which is gone in api 2)
it is suggested to convert the QString into a unicode python2 string
http://wiki.python.org/moin/PortingPythonToPy3k/PyQt4

Do you think could be the way to go for the qt backend?

Cheers,
Michele.

On Fri, Feb 25, 2011 at 12:30 AM, Michele Mattioni matti...@gmail.com wrote:
 Dear list,

 I'm trying to to use matplotlib in a Qt application which needs the
 sip API set to 2

        import sip
        sip.setapi('QString', 2)

 However if I do this I get this error

        ImportError: cannot import name QString

 I'm wondering if I'm the first to stumble upon this one, or this is a
 known solution.

 Below the whole Traceback.

 Thanks,
 Michele.


        In [3]: import sip

        In [4]: sip.setapi('QString', 2)

        In [5]: import matplotlib.pyplot as plt
        
 ---
        ImportError                               Traceback (most recent call 
 last)

        /home/mattions/Work/model/MSN/Neuronvisio/examples/ipython console
 in module()

        /usr/lib/pymodules/python2.6/matplotlib/pyplot.py in module()
                 93
                 94 from matplotlib.backends import pylab_setup
        --- 95 new_figure_manager, draw_if_interactive, show = pylab_setup()
                 96
                 97 @docstring.copy_dedent(Artist.findobj)

        /usr/lib/pymodules/python2.6/matplotlib/backends/__init__.pyc in 
 pylab_setup()
                 23         backend_name = 
 'matplotlib.backends.%s'%backend_name.lower()
                 24     backend_mod = __import__(backend_name,
        --- 25                              globals(),locals(),[backend_name])
                 26
                 27     # Things we pull in from all backends


        /usr/lib/pymodules/python2.6/matplotlib/backends/backend_qt4agg.py in
 module()
                 10
                 11 from backend_agg import FigureCanvasAgg
        --- 12 from backend_qt4 import QtCore, QtGui, FigureManagerQT,
 FigureCanvasQT,\
                 13      show, draw_if_interactive, backend_version, \
                 14      NavigationToolbar2QT

        /usr/lib/pymodules/python2.6/matplotlib/backends/backend_qt4.py in 
 module()
                 14 from matplotlib.mathtext import MathTextParser
                 15 from matplotlib.widgets import SubplotTool
        --- 16 import matplotlib.backends.qt4_editor.figureoptions as 
 figureoptions
                 17
                 18 try:

        
 /usr/lib/pymodules/python2.6/matplotlib/backends/qt4_editor/figureoptions.py
 in module()
                  9 import os.path as osp
                 10
        --- 11 import matplotlib.backends.qt4_editor.formlayout as formlayout
                 12 from PyQt4.QtGui import QIcon
                 13

        
 /usr/lib/pymodules/python2.6/matplotlib/backends/qt4_editor/formlayout.py
 in module()
                 57                          QDateEdit, QDateTimeEdit, QFont, 
 QFontComboBox,
                 58                          QFontDatabase, QGridLayout)
        --- 59 from PyQt4.QtCore import (Qt, SIGNAL, SLOT, QSize, QString,
                 60                           pyqtSignature, pyqtProperty)
                 61 from datetime import date

        ImportError: cannot import name QString

--
Free Software Download: Index, Search  Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users