Re: [Matplotlib-users] Errorbars not drawn correctly in logarithmic scales

2012-03-09 Thread Wolfgang Draxinger
On Thu, 8 Mar 2012 19:47:05 -0600
Benjamin Root ben.r...@ou.edu wrote:

 Which version of matplotlib are you using?  Also, are you setting the
 log scale before (preferred) or after (won't work) the call to hist()?

Version is matplotlib-1.1.0, installed through standard Gentoo ebuild.
And the scale parameters are set before all the drawing calls.


Wolfgang

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] backend with edition capabilities

2012-03-09 Thread François Beaubert

Le 05/03/2012 21:37, Federico Ariza a écrit :

Hi

As I thought, this is a tricky subject.

So far I just opened a github account and added the three files that I 
am using.

https://github.com/fariza/MPL-Experimental-Backend
I have tested this on linux, I do not know if it works on windows.

I know glade is not the right way to do it if I want this to be taken 
serously.
So far the only thing I want is to experiment and see what subset of 
actions are needed by most people.


The code is ugly but if this is something that more people find 
useful, I will do something about that, if not I will keep it to 
myself and my personal use.


Thanks
Federico


P.S. The group expander is because I have personal need of line group 
management

P.S.2. The toolbar will be modified to be unified among all the figures
P.S.3. The figures are arranged in a notebook because I hate having 
multiple open windows from the same source.
P.S.4. I am thinking on adding a shell with all the figure and line 
instances ready to be modified by hand.


On Wed, Feb 29, 2012 at 5:02 PM, Federico Ariza 
ariza.feder...@gmail.com mailto:ariza.feder...@gmail.com wrote:


Dear all

I am a long time matplotlib user  (under linux) but new to the
list (second post).

On of the things that bothers me the most is the inability of the
standard backend to change simple things (line color, labels, etc...).

I resorted to create a simple FrankeinBackend (based on the GtkAgg)
I guess I am not the only one missing this kind of features or
experimenting with similar ideas.

Some points comes to my mind:
Is there any special place where we can share and discuss this?
Is it better if I just open a googlecode place for my code.?
This is a recurring question and I have no idea what I am talking
about
This is already done I am reinventing the wheel

Thanks
Federico

-- 
Y yo que culpa tengo de que ellas se crean todo lo que yo les digo?


-- Antonio Alducin --




--
Y yo que culpa tengo de que ellas se crean todo lo que yo les digo?

-- Antonio Alducin --


--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2


___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Hi,

Great project and addition to matplotlib ! Something that was missing 
for me ... thanks !
I've tried to use your backend with editions capabilities but i'm stick 
with this erro:


python test.py
Traceback (most recent call last):
  File test.py, line 4, in module
import matplotlib.pyplot as plt
  File /usr/lib/pymodules/python2.7/matplotlib/pyplot.py, line 95, in 
module

new_figure_manager, draw_if_interactive, show = pylab_setup()
  File /usr/lib/pymodules/python2.7/matplotlib/backends/__init__.py, 
line 25, in pylab_setup

globals(),locals(),[backend_name])
  File 
/home/beaubert/Téléchargements/fariza-MPL-Experimental-Backend-aa7ce4a/experimentalbackend.py, 
line 34, in module

settings.props.gtk_button_images = True
AttributeError: 'gobject.GProps' object has no attribute 'gtk_button_images'

I'm on Kubuntu 11.10.
Thank's

Cheers
Francois
attachment: francois_beaubert.vcf--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Clearing 3D plots plotted in figure canvas

2012-03-09 Thread Sourabh Bajaj
I am creating a PyQT based tool. that has a Figure canvas embedded in it.

I want to update the plot on some event. I can draw the plot perfectly.
But how do I clear the plot without removing the mouse movement 
capabilities.

axes.cla, fixes the axis movement as well.


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Stack Plot

2012-03-09 Thread Trillian

Hello All, 

How do I control a width and length of a boxes in a stack plot? Currently
with the code I have, I can only control the separation or the white-space
between the two plots. I would like the top plot to be larger in length and
narrow in width while the bottom plot to have the same width as the top but
the length to be much shorter than the top. Please see figure. 

http://old.nabble.com/file/p33468632/RVs.png RVs.png 


#!/usr/bin/env python

import asciitable
data = asciitable.read('RVs.dat')
# To use the variables in asciitable use col1, col2, etc..

from pylab import *

f = figure()
subplots_adjust(hspace=1)

ax1 = subplot(211)
ax1.plot(data.col6,data.col5, 'ko')
ylabel('RV using GJ406')
title('RV comparison')

ax2 = subplot(212, sharex=ax1)
ax2.plot(data.col6,data.col5-data.col6,'ko' )
xlabel('RV (km/s)')
ylabel('Residuals (km/s)')
# The line below takes away the x-axis values from top plot. 
xticklabels = ax1.get_xticklabels()+ax2.get_xticklabels()
setp(xticklabels, visible=True)
savefig('RVs.png')

Thanks, 

Trillian


-- 
View this message in context: 
http://old.nabble.com/Stack-Plot-tp33468632p33468632.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] x and y labels that span multiple axes

2012-03-09 Thread Jonathan Slavin
Hi all,

I'm plotting a set of subplots (2 x 3) and I'd like to label the x and y
axes with one title each (i.e. spanning the axes) since the units of all
the x axes and y axes are the same.  I know that I can use fig.text to
do it, though that would require some fiddling on my part to get the
placement right.  Is there an easier way?

Jon
-- 
__
Jonathan D. Slavin  Harvard-Smithsonian CfA
jsla...@cfa.harvard.edu 60 Garden Street, MS 83
phone: (617) 496-7981   Cambridge, MA 02138-1516
 cell: (781) 363-0035   USA
__


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Errorbars not drawn correctly in logarithmic scales

2012-03-09 Thread Wolfgang Draxinger
On Fri, 9 Mar 2012 11:19:15 -0600
Benjamin Root ben.r...@ou.edu wrote:
 
 Can I have the data you used to produce these errorbars so I can test
 this bug?

Here's the data

#  Fluence -sigma Signal...  -sigma   area
  1127  48.32  9.114  10.31 0.1318
 1.127e+04  482.9  35.96  16.15 0.4994
 1.127e+05   4829  231.2  101.1  2.568
 1.127e+06  4.829e+04   4631   1689  12.22

And here's the ploting tool source code (also used for generating the
linked PDF).

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# vim: filetype python

import sys, os, argparse

import math, numpy, scipy, scipy.optimize

import matplotlib, matplotlib.cm
import matplotlib.pyplot as pyplot
import pylab

def expmodel(p, x):
return p[0] + numpy.exp(p[1]*x)*p[2]

def experror(p, x, y):
return y - expmodel(p, x)

def linmodel(p, x):
return p[0] + p[1]*x

def linerror(p, x, y):
return y - linmodel(p, x)

if __name__ == '__main__':
optparse = argparse.ArgumentParser(description='plot raddark dat files 
with errorbars and linear or exponential model regression plots', 
prog=sys.argv[0])
optparse.add_argument('--xlabel', type=str, default='Particle Count')
optparse.add_argument('--ylabel', type=str, default='Signal')
optparse.add_argument('--title', type=str, default='')
optparse.add_argument('--outlier', '-O', action='append', type=str)
optfitgrp = optparse.add_mutually_exclusive_group()
optfitgrp.add_argument('--exp', '-e', action='store_true')
optfitgrp.add_argument('--lin', '-l', action='store_true')
optparse.add_argument('--log', action='store_true')
optparse.add_argument('files', type=str, nargs='+')

options = optparse.parse_args(sys.argv[1:])

data = [ numpy.loadtxt(filename) for filename in options.files ]

if options.outlier:
outlier = [ numpy.loadtxt(filename) for filename in 
options.outlier ]

ax = pyplot.subplot(1,1,1)
if options.log:
ax.loglog()

ax.set_title(options.title)
ax.set_xlabel(options.xlabel)
ax.set_ylabel(options.ylabel)
ax.grid(True, 'both')

for f,d in zip(options.files, data):
ax.errorbar(d[..., 0], d[..., 2], d[..., 3], d[..., 1], 
fmt='o', label=f)

if options.outlier:
for f,d in zip(options.outlier, outlier):
ax.errorbar(d[..., 0], d[..., 2], d[..., 3], d[..., 1], 
fmt='+', label=f)

if options.exp or options.lin:
data_xs = numpy.concatenate( [ d[..., 0] for d in data ] )
data_ys = numpy.concatenate( [ d[..., 2] for d in data ] )
if options.outlier:
x_max = numpy.nanmax( numpy.concatenate((data_xs, 
numpy.concatenate([ o[..., 0] for o in outlier ]))) )
x_min = numpy.nanmin( numpy.concatenate((data_xs, 
numpy.concatenate([ o[..., 0] for o in outlier ]))) )
else:
x_max = numpy.nanmax(data_xs)
x_min = numpy.nanmin(data_xs)
x_ptp = x_max - x_min
xs = numpy.arange(x_min - 0.05*x_ptp, x_max + 0.05*x_ptp, 
x_ptp/1.)

if options.exp:
p = scipy.optimize.leastsq(experror, 
[numpy.nanmin(data_ys), 1e-6/x_ptp, 1./numpy.ptp(data_ys)], args=(data_xs, 
data_ys))
ys = expmodel(p[0], xs)
if options.lin:
p = scipy.optimize.leastsq(linerror, 
[numpy.nanmin(data_ys), 1./x_ptp, 1./numpy.ptp(data_ys)], args=(data_xs, 
data_ys))
ys = linmodel(p[0], xs)

ax.plot(xs, ys, label=fit)

ax.legend(loc='upper left')

pyplot.show()

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Stack Plot

2012-03-09 Thread Benjamin Root
On Thu, Mar 8, 2012 at 5:05 PM, Trillian singlebin...@gmail.com wrote:


 Hello All,

 How do I control a width and length of a boxes in a stack plot? Currently
 with the code I have, I can only control the separation or the white-space
 between the two plots. I would like the top plot to be larger in length and
 narrow in width while the bottom plot to have the same width as the top but
 the length to be much shorter than the top. Please see figure.

 http://old.nabble.com/file/p33468632/RVs.png RVs.png


 #!/usr/bin/env python

 import asciitable
 data = asciitable.read('RVs.dat')
 # To use the variables in asciitable use col1, col2, etc..

 from pylab import *

 f = figure()
 subplots_adjust(hspace=1)

 ax1 = subplot(211)
 ax1.plot(data.col6,data.col5, 'ko')
 ylabel('RV using GJ406')
 title('RV comparison')

 ax2 = subplot(212, sharex=ax1)
 ax2.plot(data.col6,data.col5-data.col6,'ko' )
 xlabel('RV (km/s)')
 ylabel('Residuals (km/s)')
 # The line below takes away the x-axis values from top plot.
 xticklabels = ax1.get_xticklabels()+ax2.get_xticklabels()
 setp(xticklabels, visible=True)
 savefig('RVs.png')

 Thanks,

 Trillian


Perhaps GridSpec is what you need:

http://matplotlib.sourceforge.net/users/gridspec.html

Cheers!
Ben Root
--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] x and y labels that span multiple axes

2012-03-09 Thread Jeffrey Blackburne

On Mar 9, 2012, at 1:05 PM, Jonathan Slavin wrote:

 Hi all,

 I'm plotting a set of subplots (2 x 3) and I'd like to label the x  
 and y
 axes with one title each (i.e. spanning the axes) since the units  
 of all
 the x axes and y axes are the same.  I know that I can use fig.text to
 do it, though that would require some fiddling on my part to get the
 placement right.  Is there an easier way?

 Jon

Hi Jon,

The way I do this is to create a master axis that overlaps the  
others with dimensions equal to the outer border of all the other  
axes. Then I just use this axis for the labels:
masterAxis.set_xlabel(ick)
masterAxis.set_ylabel(blech)

You also have to turn off ticks and tick labels for this axis:
masterAxis.xaxis.set_major_formatter(mpl.ticker.NullFormatter())
masterAxis.yaxis.set_major_formatter(mpl.ticker.NullFormatter())

Since it doesn't know about tick labels, it may not position the axis  
labels far enough away from the axis line, so you can adjust the  
spacing:
masterAxis.xaxis.labelpad += 6
masterAxis.yaxis.labelpad += 4

It's still a little fiddly, but less fiddly than using fig.text. I  
bet this could be significantly improved, e.g. with Axes_Grid, but I  
don't know how to do that.

Cheers,
Jeff



--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Stack Plot

2012-03-09 Thread Trillian

Perfect! That is what I was looking for! 

Thanks a lot! 

Trillian


Benjamin Root-2 wrote:
 
 On Thu, Mar 8, 2012 at 5:05 PM, Trillian singlebin...@gmail.com wrote:
 

 Hello All,

 How do I control a width and length of a boxes in a stack plot? Currently
 with the code I have, I can only control the separation or the
 white-space
 between the two plots. I would like the top plot to be larger in length
 and
 narrow in width while the bottom plot to have the same width as the top
 but
 the length to be much shorter than the top. Please see figure.

 http://old.nabble.com/file/p33468632/RVs.png RVs.png


 #!/usr/bin/env python

 import asciitable
 data = asciitable.read('RVs.dat')
 # To use the variables in asciitable use col1, col2, etc..

 from pylab import *

 f = figure()
 subplots_adjust(hspace=1)

 ax1 = subplot(211)
 ax1.plot(data.col6,data.col5, 'ko')
 ylabel('RV using GJ406')
 title('RV comparison')

 ax2 = subplot(212, sharex=ax1)
 ax2.plot(data.col6,data.col5-data.col6,'ko' )
 xlabel('RV (km/s)')
 ylabel('Residuals (km/s)')
 # The line below takes away the x-axis values from top plot.
 xticklabels = ax1.get_xticklabels()+ax2.get_xticklabels()
 setp(xticklabels, visible=True)
 savefig('RVs.png')

 Thanks,

 Trillian


 Perhaps GridSpec is what you need:
 
 http://matplotlib.sourceforge.net/users/gridspec.html
 
 Cheers!
 Ben Root
 
 --
 Virtualization  Cloud Management Using Capacity Planning
 Cloud computing makes use of virtualization - but cloud computing 
 also focuses on allowing computing to be delivered as a service.
 http://www.accelacomm.com/jaw/sfnl/114/51521223/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 

-- 
View this message in context: 
http://old.nabble.com/Stack-Plot-tp33468632p33474293.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Error when saving as PDF using $\alpha$ and 'text.usetex':True

2012-03-09 Thread Alejandro Weinstein
On Thu, Mar 8, 2012 at 12:45 PM, Jouni K. Seppänen j...@iki.fi wrote:
 Alejandro Weinstein alejandro.weinst...@gmail.com writes:

 TypeError: unicode argument expected, got 'str'
 I am using MPL verion 1.2.x (built from commit 396a6446).

 That reminds me of a problem fixed in commit 680edf7, so could you
 either try cherry-picking that commit or updating to a later revision?
 Your test case doesn't produce an error on a recent-ish master.

You're right. Just updated to the last version and the problem is gone.

Thanks!

Alejandro.

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Centering Text with axes_divider

2012-03-09 Thread Patrick Marsh
Hi, All,

Here's an update to the problem I submitted last night.

I was able to utilize anchored text to work for centering a title, which is
ultimately what I'm wanting to do now. (Although, I'd still like to know
the proper way to get the axes bounds when using axes_divider).  The new
problem lies how to horizontally align the text inside the anchored box.
When the horizontal alignment is left, the text lines up in the anchored
box. However, as the updated example below shows, then you use center or
right, the text is now positioned outside the anchored box.  Is this a
bug in how the text is aligned? If so, how might I go about tracking it
down?


https://gist.github.com/2004869 (rev: b984ca)


Cheers,
Patrick
---
Patrick Marsh
Ph.D. Student / Liaison to the HWT
School of Meteorology / University of Oklahoma
Cooperative Institute for Mesoscale Meteorological Studies
National Severe Storms Laboratory
http://www.patricktmarsh.com



On Fri, Mar 9, 2012 at 12:12 AM, Patrick Marsh patrickmars...@gmail.comwrote:

 Greetings,

 Let me begin by saying that I've fallen in love with ImageGrid. I love the
 control it gives me in setting up plots, and I really like the control it
 offers for setting up a colorbar. Unfortunately, like all relationships,
 ImageGrid and I have hit a rough patch.

 I like to manually place titles and other boxes of texts on plots that I
 make using ImageGrid. However, to center things I have to know what the
 axes bounds are so I can do the centering calculations. Unfortunately, when
 using ImageGrid, or axes_divider, I have yet to find a way to get the axes
 bounds that are actually used to do the plotting. When I try to use

 ax.get_position().bounds

 I get the pre-adjusted bounds, even if I use plt.draw() before requesting
 the axes_positions. This means the only way I can center the text is by
 guessing what the final axes bounds will be.  Is there any way of getting
 the final bounds? It appears anchored text is able to do it, but I haven't
 been able to...


 Here's a self-contained example script that demonstrates the problem.  I
 don't use ImageGrid, instead using axes_divider, however this is the same
 problem that AxesGrid has. (I'm guessing this is because ImageGrid
 ultimately does what I did here behind the scenes.)

 https://gist.github.com/2004869


 Thanks for any help!


 Patrick
 ---
 Patrick Marsh
 Ph.D. Student / Liaison to the HWT
 School of Meteorology / University of Oklahoma
 Cooperative Institute for Mesoscale Meteorological Studies
 National Severe Storms Laboratory
 http://www.patricktmarsh.com



--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users