[Matplotlib-users] boxplot

2013-03-14 Thread Paul . Czodrowski
Dear Matplotlibbers,

I'm running matplotlib 1.1.0 and would like to plot pairs of values, 
e.g.
[[0.27,0.43],[0.17,0.35]]

When using boxplot, the values of the pairs correspond to the outer 
whiskers, but I would like that the interquartile ranges correspond to 
the value pairs. The whiskers shall NOT be shown.

The rationale behind the value pairs: these pairs correspond to confidence 
intervals, and I would like to compare confidence intervals from different 
measurements and thought that matplotlib could help me.



Cheers  Thanks,
Paul


This message and any attachment are confidential and may be privileged or 
otherwise protected from disclosure. If you are not the intended recipient, you 
must not copy this message or attachment or disclose the contents to any other 
person. If you have received this transmission in error, please notify the 
sender immediately and delete the message and any attachment from your system. 
Merck KGaA, Darmstadt, Germany and any of its subsidiaries do not accept 
liability for any omissions or errors in this message which may arise as a 
result of E-Mail-transmission or for damages resulting from any unauthorized 
changes of the content of this message and any attachment thereto. Merck KGaA, 
Darmstadt, Germany and any of its subsidiaries do not guarantee that this 
message is free of viruses and does not accept liability for any damages caused 
by any virus transmitted therewith.

Click http://www.merckgroup.com/disclaimer to access the German, French, 
Spanish and Portuguese versions of this disclaimer.--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib, Tk, and multithreading

2013-03-14 Thread Benjamin Root
On Wed, Mar 13, 2013 at 9:43 PM, Oliver King oliver.afr...@gmail.comwrote:

 Hi,

 I have a library which uses matplotlib to produce some plots. This library
 is called by a thread. However, python crashes with this error when it
 tries to plot something:

 Tk_MacOSXSetupTkNotifier: first [load] of TkAqua has to occur in the main
 thread!

 If I do as it says and call window = Tkinter.Tk() in the main thread
 before spawning the thread which calls the plotting routines, it works well
 until the program shuts down. When shutting down, I get a series of these
 messages (8 of them, to be precise):

 Exception RuntimeError: RuntimeError('main thread is not in main loop',)
 in bound method PhotoImage.__del__ of Tkinter.PhotoImage instance at
 0x90fe260 ignored

 Googling reveals to me that this is a problem with Tk: it doesn't like
 threading. I tried to force matplotlib to use a different backend with this
 command:
 matplotlib.rcParams['backend'] = something_else
 but it still crashes with the first error.

 Has anyone encountered this problem before? How did you overcome it?


Are you displaying the plots in the thread, or are you just saving the
plots directly?  If you are saving them directly, then you can set your
backend to be Agg and get rid of the Tkinter.Tk() call (and probably
should get rid of the import as well).  That way, matplotlib won't load up
any gui toolkits at all.

Cheers!
Ben Root
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Matplotlib Slider Widget and changing colorbar threshold

2013-03-14 Thread kevin
I am currently trying to work on a program that will allow the user to
display their dataset in the form of a colormap and through the use of
sliders, it will also allow the user to adjust the threshold of the colormap
and thus update the colormap accordingly.  The best to describe this would
be through the use of a picture:  


  [1]: http://i.stack.imgur.com/1T9Qp.png


This image shows how the colorbar should look before (the image on the left)
and after (the image on the right) the adjustment.  As the threshold values
of the colrobar are changed, the colormap would be updated accordingly.

Now I am mainly using matplotlib and I found that matplotlib does support
some widgets, such as a slider.  However the area I need help in is devising
a piece of code which will update the colorbar and colormap (like the way
shown in the picture above) when the slider is adjusted.  I was wondering if
anyone has done this before and might have a piece of code they would be
willing to share and might have pointers as to how this can be achieved.



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Matplotlib-Slider-Widget-and-changing-colorbar-threshold-tp40654.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] rec2csv - forcing precision

2013-03-14 Thread asayeed
Hi there, 

It seems a little odd to me that rec2csv would overthrow float formatting,
such as FormatFloat(2).  I am reading in a file that looks like (with
csv2rec):

ES2006a C   2_1 if  23.53   23.66   0.130.17-0.7844
-2.2863 IN  4.819   1.981   2.838   if  0   0   
ES2006a C   2_1 it  23.66   23.74   0.080.21-1.3039
-1.7667 PRP 2.802   1.518   1.284   it  0   0   
ES2006a C   2_1 was 23.74   23.90.160.27-0.663 
-2.5537 AUX 2.694   0.955   1.739   was 0   0   
ES2006a C   2_1 sent23.924.17   0.270.36-2.62  
-4.062  VBN 6.964   1.317   5.647   sent1   2   

And I am doing a few numpy things to it, and then spitting the results back
out into a file that ends up looking like this:

ES2006a C   2_1 if  23.531  23.66   0.13   
0.17
001 -0.78439-2.28630002 IN 
4.819   
1.9811  2.8381  if  0   0   0.0
ES2006a C   2_1 it  23.66   23.738 
0.08
00020.20999 -1.30390001 -1.7666 
PRP 2.802   1.518   1.284   it  0   0   0.0
ES2006a C   2_1 was 23.738  23.899  
0.160.27002 -0.66303-2.55370001
AUX 2.694   0.95496 1.7391  was 0  
0   0.0
ES2006a C   2_1 sent23.899  24.172 
0.27002 0.35999 -2.6201
-4.0623 VBN 6.964   1.3169 
5.6472  sent1   2   0.0

which is not at all what I want.  I want the numbers to look like the
originally did in the input file...or at least better truncated.

I tried to use FormatFloat(n), but the documentation (plus the mlib code)
says that rec2csv overrides the FormatFloat to get a %r format.  

My stopgap measure is to create my own FormatFloatForce that looks like
this:

class FormatFloatForce(mlab.FormatFormatStr):
def __init__(self):
mlab.FormatFormatStr.__init__(self, %g)

def toval(self, x):
return x

def fromstr(self, s):
return float(s)

But this seems rather hideous to me, especially since I have to apply it to
every numerical column.  Am I simply doing this all wrong?

Yours,
--Asad.



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/rec2csv-forcing-precision-tp40655.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] ticklabels

2013-03-14 Thread Andrew H. Jaffe
Dear all, 

None of the obvious ways for changing ticklabels seem to work for the current 
version of Matplotlib (1.2.0 for me). At present, 
ax.yaxis.get_ticklabels().get_text() returns empty strings, as does 
ax.get_yticklabels(), and the equivalent set_* functions don't seem to have any 
effect. 

So: help! 

Yours, 

Andrew
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] boxplot

2013-03-14 Thread Paul Hobson
On Thu, Mar 14, 2013 at 12:40 AM, paul.czodrow...@merckgroup.com wrote:

 Dear Matplotlibbers,

 I'm running matplotlib 1.1.0 and would like to plot pairs of values,
 e.g.
 [[0.27,0.43],[0.17,0.35]]

 When using boxplot, the values of the pairs correspond to the outer
 whiskers, but I would like that the interquartile ranges correspond to the
 value pairs. The whiskers shall NOT be shown.

 The rationale behind the value pairs: these pairs correspond to confidence
 intervals, and I would like to compare confidence intervals from different
 measurements and thought that matplotlib could help me.



 Cheers  Thanks,
 Paul


You lost me. Are you trying to create box and whisker plots or do you just
want rectangles? N = 2 is awfully small dataset for box/whisker plots. If
all you want are the rectangles -- use those directly:

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle

data = np.array([[0.27,0.43],[0.17,0.35]])
fig, ax = plt.subplots()
box_width = 0.5
for pos, row in enumerate(data):
xy = (pos+1, np.min(row))
box_height = np.max(row) - np.min(row)
box = Rectangle(xy, box_width, box_height, facecolor='white',
edgecolor='black', linewidth=1.5)
ax.add_patch(box)

ax.set_xlim([0, pos+2])
ax.set_ylim([0, data.max()*1.25])
plt.show()
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] boxplot

2013-03-14 Thread Paul . Czodrowski


 You lost me. Are you trying to create box and whisker plots or do
 you just want rectangles? N = 2 is awfully small dataset for box/
 whisker plots. If all you want are the rectangles -- use those directly:

 import numpy as np
 import matplotlib.pyplot as plt
 from matplotlib.patches import Rectangle

 data = np.array([[0.27,0.43],[0.17,0.35]])
 fig, ax = plt.subplots()
 box_width = 0.5
 for pos, row in enumerate(data):
     xy = (pos+1, np.min(row))
     box_height = np.max(row) - np.min(row)
     box = Rectangle(xy, box_width, box_height, facecolor='white',
 edgecolor='black', linewidth=1.5)
     ax.add_patch(box)

 ax.set_xlim([0, pos+2])
 ax.set_ylim([0, data.max()*1.25])
 plt.show()


Dear Paul,

sorry for misleading you!

Indeed, I'm more interested in a rectangle, exactly as you showed it!


Your code and quick response is highly appreciated!


Cheers,
Paul

This message and any attachment are confidential and may be privileged or
otherwise protected from disclosure. If you are not the intended recipient,
you must not copy this message or attachment or disclose the contents to
any other person. If you have received this transmission in error, please
notify the sender immediately and delete the message and any attachment
from your system. Merck KGaA, Darmstadt, Germany and any of its
subsidiaries do not accept liability for any omissions or errors in this
message which may arise as a result of E-Mail-transmission or for damages
resulting from any unauthorized changes of the content of this message and
any attachment thereto. Merck KGaA, Darmstadt, Germany and any of its
subsidiaries do not guarantee that this message is free of viruses and does
not accept liability for any damages caused by any virus transmitted
therewith.

Click http://www.merckgroup.com/disclaimer to access the German, French,
Spanish and Portuguese versions of this disclaimer.


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib, Tk, and multithreading

2013-03-14 Thread Oliver King
Hi Ben,

 Are you displaying the plots in the thread, or are you just saving the plots 
 directly?  If you are saving them directly, then you can set your backend to 
 be Agg and get rid of the Tkinter.Tk() call (and probably should get rid of 
 the import as well).  That way, matplotlib won't load up any gui toolkits at 
 all.

I'm saving the plots directly 
(plt.figure();plt.plot();plt.savefig();plt.close(fig)). I tried doing as you 
suggested [don't import Tk directly and change the backend to Agg] but it still 
crashes with the same TkAqua message. I don't explicitly import or use Tk 
anywhere in my code, so it seems that matplotlib is trying to load it anyway 
even when instructed to use a different backend.

I'm running Enthought Python 7.3-2 on Mac OS X 10.6.8. Note that this problem 
seems to be restricted to this particular operating system; when I run the code 
on CentOS, also using EPD 7.3-2, it does not crash.

Cheers,
Oliver


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib, Tk, and multithreading

2013-03-14 Thread Goyo
2013/3/14 Oliver King oliver.afr...@gmail.com:
 [...]
 I tried doing as you suggested [don't import Tk directly and change the 
 backend to Agg] but it still crashes with the same TkAqua message.

You must set the desired backend from the very begining and before
importing pylab o pyplot.

Goyo

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib, Tk, and multithreading

2013-03-14 Thread Oliver King

 You must set the desired backend from the very begining and before
 importing pylab o pyplot.

That did it - I made the change in my .matplotlibrc file and it no longer 
crashes.

Thanks!
Oliver
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ticklabels

2013-03-14 Thread Goyo
2013/3/14 Andrew H. Jaffe a.h.ja...@gmail.com:
 Dear all,

 None of the obvious ways for changing ticklabels seem to work for the current 
 version of Matplotlib (1.2.0 for me). At present, 
 ax.yaxis.get_ticklabels().get_text() returns empty strings, as does 
 ax.get_yticklabels(), and the equivalent set_* functions don't seem to have 
 any effect.

It seems to be working for me. I'm using a development version but I
don't thing this has changed.

In [1]: import matplotlib.pyplot as plt

In [2]: plt.get_backend()
Out[2]: 'TkAgg'

In [3]: plt.plot([1, 2])
Out[3]: [matplotlib.lines.Line2D at 0x424c310]

In [4]: plt.draw()

In [5]: labels = plt.gca().get_yticklabels()

In [6]: map(lambda x: x.get_text(), labels)
Out[6]: [u'1.0', u'1.2', u'1.4', u'1.6', u'1.8', u'2.0', u'2.2', '']

In [7]: plt.gca().set_yticklabels(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'])
Out[7]:
[matplotlib.text.Text at 0x3e97bd0,
 matplotlib.text.Text at 0x3ea2390,
 matplotlib.text.Text at 0x42bed90,
 matplotlib.text.Text at 0x42c0390,
 matplotlib.text.Text at 0x42c05d0,
 matplotlib.text.Text at 0x42c0c50,
 matplotlib.text.Text at 0x42c1310,
 matplotlib.text.Text at 0x42c1990]

In [8]: map(lambda x: x.get_text(), labels)
Out[8]: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']

Goyo

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ticklabels

2013-03-14 Thread ChaoYue
it also works for me for 1.2.0
In [1]: mat.__version__
Out[1]: '1.2.0'

In [2]: plot(np.arange(5),'ro')
Out[2]: [matplotlib.lines.Line2D at 0xc88262c]

In [3]: ax = gca()

In [4]: ax.set_xticklabels('abcdefghij')
Out[4]: 
[matplotlib.text.Text at 0xbbb048c,
 matplotlib.text.Text at 0xbbb0c8c,
 matplotlib.text.Text at 0xc88780c,
 matplotlib.text.Text at 0xc887e2c,
 matplotlib.text.Text at 0xc88b4cc,
 matplotlib.text.Text at 0xc88bb4c,
 matplotlib.text.Text at 0xc8911ec,
 matplotlib.text.Text at 0xc89186c,
 matplotlib.text.Text at 0xc891eec]

In [5]: [t.get_text() for t in ax.get_xticklabels()]
Out[5]: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']





--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/ticklabels-tp40656p40663.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users