[Matplotlib-users] Set Histogram yrange

2009-07-20 Thread marcog

Hi

Is it possible to set the yrange of a histogram plot? I have a number of
histograms on separate plots that I would like to have the same yrange to
make them easier to compare.

Thanks
Marco
-- 
View this message in context: 
http://www.nabble.com/Set-Histogram-yrange-tp24566489p24566489.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] APLpy 0.9.3 Release

2009-07-20 Thread Astronomical Python
We are pleased to announce the release of APLpy 0.9.3, which includes
bug fixes, improvements, and new features.

APLpy is a python module that makes it easy to interactively produce
publication-quality plots of astronomical images in FITS format. More
details are available at http://aplpy.sourceforge.net/

One of the main additions in this release is the ability to produce RGB
images starting from FITS files with different projections. More
information on the changes in this release is available in the release
notes available from the APLpy homepage.

From the front page you can sign up to the mailing list and/or the
Twitter feed to be kept up-to-date on future releases.

Cheers,

Eli Bressert and Thomas Robitaille

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Colorbar not working with specgram

2009-07-20 Thread davide lasagna

Hello everybody,
this is my first post in this list. 

I'm plotting a spectrogram with

Pxx, freqs, bins, im = specgram(y, nfft=256, f_sampling=12000)

and i want to add a colorbar with

colorbar()


The problem is that the color scale seems to be wrong with respect to
the data in Pxx, i.e. Pxx is of the order of 1e-2 while in the colorbar
i have tick values spanning from -20 to -180. What is the problem??

Thanks in advance!


Davide


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] rotating labels, what is wrong?!

2009-07-20 Thread John [H2O]

I am trying simply to shrink the font size and rotate xaxis labels:

fig1 = plt.figure()
ax1 = fig1.add_subplot(211)
ax2 = fig1.add_subplot(212)
ax1.plot_date(x,y,'r')
ax1.set_xticklabels(plt.gca().get_xmajorticklabels(), 
size=6,rotation=30) 
  
ax2.plot_date(o_X['time'],o_X['CO'],'y')  
ax2.set_xticklabels(plt.gca().get_xmajorticklabels(),
 size=6,rotation=30) 

I end up with labels as:  (Text(0,0Text(0,0,))


-- 
View this message in context: 
http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24572302.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Set Histogram yrange

2009-07-20 Thread Matthias Michler
Hi Marco,

you can set the yrange for the axes after the historgram was plotted, e.g. :

hist(arange(30)%3)
ylim(0, 15)

best regards Matthias


On Monday 20 July 2009 11:26:27 marcog wrote:
 Hi

 Is it possible to set the yrange of a histogram plot? I have a number of
 histograms on separate plots that I would like to have the same yrange to
 make them easier to compare.

 Thanks
 Marco



--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib+Qt. Problem with plot resizing

2009-07-20 Thread Darren Dale
Hi Alexander,

2009/7/20 Alexander Bruy volt...@ua.fm:
 Sorry, some troubles with my email service. With attachment now


 2009/17/07 Darren Dale dsdal...@gmail.com wrote:

 Please post a short, complete, self-contained script demonstrating the
 problem.


 I create a small example, see attachment. There is a simple dialog with 
 QWidget, at which
 matplotlib plot is drawn. When dialog resized the plot don't change it's size.
 I'm would be grateful for an indication of my errors and working example.

You need to add a layout to your widgetPlot, and then add your canvas
to that layout. See attached.

Darren
# -*- coding: utf-8 -*-

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from dlgTest import Ui_dlgMPLTest

import sys

from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure

class TestDialog( QDialog, Ui_dlgMPLTest ):
	def __init__( self, parent = None ):
		super( TestDialog, self ).__init__( parent )
		self.setupUi( self )
		
		# initialize mpl plot
		self.figure = Figure()
		#self.figure.set_figsize_inches( ( 4.3, 4.2 ) )
		self.axes = self.figure.add_subplot( 111 )
		self.figure.suptitle( Frequency distribution, fontsize = 12 )
		self.axes.grid( True )
		self.canvas = FigureCanvas( self.figure )
layout = QVBoxLayout()
self.widgetPlot.setLayout(layout)
layout.addWidget(self.canvas)
		#self.canvas.setParent( self.widgetPlot )
		
		# draw mpl plot
		#self.axes.clear()
		#self.axes.grid( True )
		#self.figure.suptitle( Frequency distribution, fontsize = 12 )
		self.axes.set_ylabel( Count, fontsize = 8 )
		self.axes.set_xlabel( Values, fontsize = 8 )
		x = [ 4, 1, 5, 3, 3, 2, 3, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1 ]
		n, bins, pathes = self.axes.hist( x, 18, alpha=0.5, histtype = bar )
		self.canvas.draw()
		
		self.setWindowTitle( self.tr( MPL test ) )
	
if __name__ == __main__:
	app = QApplication( sys.argv )
	dialog = TestDialog()
	sys.exit( dialog.exec_() )
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] regarding networkx, matplotlib and pyqt

2009-07-20 Thread Ala Al-Shaibani
Hello everyone.

A users on the networkx mailing list posted this example which is a 
modification of the matplotlib-pyqt4 implementation which plots a networkx 
graph.

The problem I am facing with it is that two plot windows open instead of one, 
one is empty and the other contains the graph.

I can't really put my finger as to why two windows open rather than just one 
pyqt window with the plot. Any suggestions would be appreciated.

Screenshot of the two plot windows:
http://img259.imageshack.us/img259/8722/picture1ahr.jpg

Code:
#!/usr/bin/env python

# embedding_in_qt4.py --- Simple Qt4 application embedding matplotlib canvases
#
# Copyright (C) 2005 Florent Rougon
#  2006 Darren Dale
#
# This file is an example program for matplotlib. It may be used and
# modified with no restriction; raw copies as well as modified versions
# may be distributed without limitation.

import sys, os, random
from PyQt4 import QtGui, QtCore

from numpy import arange, sin, pi
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
import networkx as nx

progname = os.path.basename(sys.argv[0])
progversion = 0.1


class MyMplCanvas(FigureCanvas):
Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.).
def __init__(self, parent=None, width=5, height=4, dpi=100):
fig = Figure(figsize=(width, height), dpi=dpi)
self.axes = fig.add_subplot(111)
# We want the axes cleared every time plot() is called
self.axes.hold(False)

self.compute_initial_figure()

#
FigureCanvas.__init__(self, fig)
self.setParent(parent)

FigureCanvas.setSizePolicy(self,
  QtGui.QSizePolicy.Expanding,
  QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)

def compute_initial_figure(self):
pass


class MyStaticMplCanvas(MyMplCanvas):
Simple canvas with a sine plot.
def compute_initial_figure(self):
G=nx.path_graph(10)
pos=nx.spring_layout(G)
nx.draw(G,pos,ax=self.axes)


class ApplicationWindow(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.setWindowTitle(application main window)

self.file_menu = QtGui.QMenu('File', self)
self.file_menu.addAction('Quit', self.fileQuit,
QtCore.Qt.CTRL + QtCore.Qt.Key_Q)
self.menuBar().addMenu(self.file_menu)

self.help_menu = QtGui.QMenu('Help', self)
self.menuBar().addSeparator()
self.help_menu.addAction('About', self.about)

self.menuBar().addMenu(self.help_menu)


self.main_widget = QtGui.QWidget(self)

l = QtGui.QVBoxLayout(self.main_widget)
sc = MyStaticMplCanvas(self.main_widget, width=5, height=4, dpi=100)
l.addWidget(sc)

self.main_widget.setFocus()
self.setCentralWidget(self.main_widget)

self.statusBar().showMessage(All hail matplotlib!, 2000)

def fileQuit(self):
self.close()

def closeEvent(self, ce):
self.fileQuit()

def about(self):
QtGui.QMessageBox.about(self, About %s % progname,
u%(prog)s version %(version)s
Copyright \N{COPYRIGHT SIGN} 2005 Florent Rougon, 2006 Darren Dale

This program is a simple example of a Qt4 application embedding matplotlib
canvases.

It may be used and modified with no restriction; raw copies as well as
modified versions may be distributed without limitation.
% {prog: progname, version: progversion})


qApp = QtGui.QApplication(sys.argv)

aw = ApplicationWindow()
aw.setWindowTitle(%s % progname)
aw.show()
sys.exit(qApp.exec_())
#qApp.exec_()


  --
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] volume_overlay3

2009-07-20 Thread Christophe Dupre
Hello all,

 

I've been trying to use the volume_overlay functions from matplotlib.finance 
without luck.

Is anyone using it? 

 

Below is a simple test program. When I run it, all the volume bars have the 
same height.

 

Thanks,

 

Christophe

 

#!/usr/bin/env python

from pylab import *

from matplotlib.dates import  DateFormatter, WeekdayLocator, HourLocator, \

 DayLocator, MONDAY, timezone

from matplotlib.finance import volume_overlay3

 

 

mondays = WeekdayLocator(MONDAY)# major ticks on the mondays

alldays= DayLocator()  # minor ticks on the days

weekFormatter = DateFormatter('%b %d')  # Eg, Jan 12

dayFormatter = DateFormatter('%d')  # Eg, 12

 

quotes = [(733456.3340278, 129.5994, 130.0, 130.550001, 129.5, 
6178), (733456.3347218, 129.75, 129.31, 129.75, 
129.31, 9109), (733456.335417, 129.5, 130.0, 130.0, 129.5, 
7548), (733456.336111, 130.0, 130.0, 130.0, 130.0, 8039), 
(733456.336805, 130.050001, 130.150001, 130.31, 
130.050001, 9633), (733456.3375002, 130.41, 
130.150001, 130.59, 130.150001, 2103), 
(733456.3381943, 130.150001, 130.44, 
130.44, 130.150001, 5428), (733456.3388895, 
130.44, 130.31, 130.44, 130.31, 
2025), (733456.3395835, 130.31, 130.150001, 
130.550001, 130.150001, 3429), (733456.3402775, 
128.91, 130.050001, 130.09, 128.91, 
1268), (733456.3409727, 130.09, 130.198001, 
130.198001, 130.050001, 2891), (733456.3416667, 
130.19, 130.34, 130.34, 130.19, 
1093), (733456.3423608, 130.41, 130.44, 130.5, 
130.41, 1102)]

 

fig = figure()

fig.subplots_adjust(bottom=0.2)

ax = fig.add_subplot(111)

ax.xaxis.set_major_locator(mondays)

ax.xaxis.set_minor_locator(alldays)

ax.xaxis.set_major_formatter(weekFormatter)

ax.xaxis.set_minor_formatter(dayFormatter)

 

volume_overlay3(ax, quotes)

 

ax.xaxis_date()

ax.autoscale_view()

setp( gca().get_xticklabels(), rotation=45, horizontalalignment='right')

 

show()

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] interactive graphing, without ipython

2009-07-20 Thread Blaine Booher
hey everyone,
  I have an interactive python application that I am using pylab with.  I am
having a problem where I can only create a graph ONE time.  all other calls
to plot() and show() cause nothing to happen.

  I have used ipython -pylab as well, but the problem I am having with
ipython is that all the graphs will show up AFTER i close my interactive
shell.  Of course, ipython works interatively every time I 'plot' or 'show'
at the ipython command line.

  Is this a backend issue? Does anyone else have this problem?

issue can be summarized as such:
from pylab import *
def p():
  plot([1,2], [1,2])
  show()
p() // works fine. graph pops up.
p() //returns nothing, no graph shows up
p() //same as above

I am on Debian Lenny, pylab .98.3-5

Blaine
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Color Map

2009-07-20 Thread Chloe Lewis
(almost?) all the colormaps exist in reversed forms, eg, cm.hot_r


On Jul 20, 2009, at 10:47 AM, Ritayan Mitra wrote:

 Hello
   I am trying to use imshow as below

 im = imshow(Z, interpolation='spline16', origin='lower', cmap=cm.hot,
 extent=(-1.,1.,-1.,1.))

 Trouble is I want to reverse the color gradient or use some  
 colorscheme
 which has lighter color at the bottom and darker higher up.  What is  
 the
 easiest solution to this problem?  Thanks a bunch.

 Rit


 --
 Enter the BlackBerry Developer Challenge
 This is your chance to win up to $100,000 in prizes! For a limited  
 time,
 vendors submitting new applications to BlackBerry App World(TM) will  
 have
 the opportunity to enter the BlackBerry Developer Challenge. See  
 full prize
 details at: http://p.sf.net/sfu/Challenge
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Chloe Lewis
Graduate student, Amundson Lab
Division of Ecosystem Sciences, ESPM
University of California, Berkeley
137 Mulford Hall - #3114
Berkeley, CA  94720-3114
chle...@nature.berkeley.edu


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Color Map

2009-07-20 Thread Eric Firing
Ritayan Mitra wrote:
 Hello
I am trying to use imshow as below
 
 im = imshow(Z, interpolation='spline16', origin='lower', cmap=cm.hot,
 extent=(-1.,1.,-1.,1.))
 
 Trouble is I want to reverse the color gradient or use some colorscheme
 which has lighter color at the bottom and darker higher up.  What is the
 easiest solution to this problem?  Thanks a bunch.

All the standard colormaps like cm.hot have reversed counterparts with 
_r appended to the name, so use cmap=cm.hot_r.

Eric
 
 Rit
 

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Color Map

2009-07-20 Thread Abhinav Verma
and if you look at the cookbook .. you can see all the available colormaps..

http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps

have fun

On Mon, Jul 20, 2009 at 8:25 PM, Eric Firing efir...@hawaii.edu wrote:

 Ritayan Mitra wrote:
  Hello
 I am trying to use imshow as below
 
  im = imshow(Z, interpolation='spline16', origin='lower', cmap=cm.hot,
  extent=(-1.,1.,-1.,1.))
 
  Trouble is I want to reverse the color gradient or use some colorscheme
  which has lighter color at the bottom and darker higher up.  What is the
  easiest solution to this problem?  Thanks a bunch.

 All the standard colormaps like cm.hot have reversed counterparts with
 _r appended to the name, so use cmap=cm.hot_r.

 Eric
 
  Rit
 


 --
 Enter the BlackBerry Developer Challenge
 This is your chance to win up to $100,000 in prizes! For a limited time,
 vendors submitting new applications to BlackBerry App World(TM) will have
 the opportunity to enter the BlackBerry Developer Challenge. See full prize
 details at: http://p.sf.net/sfu/Challenge
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] rotating labels, what is wrong?!

2009-07-20 Thread Jae-Joon Lee
get_xmajorticklabels() returns a list of matplotlib's Text objects,
not python strings.

http://matplotlib.sourceforge.net/api/axes_api.html?highlight=get_xmajorticklabels#matplotlib.axes.Axes.get_xmajorticklabels

On the other hand, set_xticklabels() takes a list of python strings.

http://matplotlib.sourceforge.net/api/axes_api.html?highlight=set_xticklabels#matplotlib.axes.Axes.set_xticklabels


Something like below will work.

plt.setp(plt.gca().get_xmajorticklabels(),
 size=6,rotation=30)


-JJ



On Mon, Jul 20, 2009 at 11:48 AM, John [H2O]washa...@gmail.com wrote:

 I am trying simply to shrink the font size and rotate xaxis labels:

 fig1 = plt.figure()
 ax1 = fig1.add_subplot(211)
 ax2 = fig1.add_subplot(212)
 ax1.plot_date(x,y,'r')
 ax1.set_xticklabels(plt.gca().get_xmajorticklabels(),
                    size=6,rotation=30)
 ax2.plot_date(o_X['time'],o_X['CO'],'y')
 ax2.set_xticklabels(plt.gca().get_xmajorticklabels(),
                     size=6,rotation=30)

 I end up with labels as:  (Text(0,0Text(0,0,))

 
 --
 View this message in context: 
 http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24572302.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.


 --
 Enter the BlackBerry Developer Challenge
 This is your chance to win up to $100,000 in prizes! For a limited time,
 vendors submitting new applications to BlackBerry App World(TM) will have
 the opportunity to enter the BlackBerry Developer Challenge. See full prize
 details at: http://p.sf.net/sfu/Challenge
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Strange issue when using Matplotlib with PyQt4

2009-07-20 Thread Lukas Hetzenecker
Hm.. I added a resize() after the show():

class Plot_tab(QTabWidget, tab):
def __init__(self):
super(Plot_tab, self).__init__()
self.setupUi(self)

self.show()
self.resize(self.size().width()+1, self.size().height()+1)
self.resize(self.size().width()-1, self.size().height()-1)

if __name__ == __main__:
import sys
app = QApplication(sys.argv)

plot_t = Plot_tab()

sys.exit(app.exec_())


Now it works, but I really want to know why..?
Is there a way to avoid this ugly workaround?

Thanks,
Lukas

Am Sonntag 19 Juli 2009 12:58:53 schrieb Lukas Hetzenecker:
 Hello,

 I've tried to resize the QTabWidget, I've searched for examples on the
 internet, added a QTabWidget and used this as the Mainwindows central
 widget - but exactly the same happened.

 It works if I replace the FigureCanvas with a Qt Widget - for example a
 text edit or a QWebView.

 Am Sonntag 19 Juli 2009 11:54:12 schrieb projetmbc:
  Lukas Hetzenecker a écrit :
   I tried to embed a Matplotlib FigureCanvas into a QTabWidget.
   But at the first start of my script - the main.py in the attatched
   example - the widget in the Tab is incorrectly sized.
   If I embed the FigureCanvas in a QTabWidget the widget is to big, but
   if I put it in a QWidget it is shown correctly.
 
  I'm not sure that is a pure MatPlotLib issue. Have you try with a big
  standard widget instead of the FigureCanvas ?
 
  Christophe

 ---
--- Enter the BlackBerry Developer Challenge
 This is your chance to win up to $100,000 in prizes! For a limited time,
 vendors submitting new applications to BlackBerry App World(TM) will have
 the opportunity to enter the BlackBerry Developer Challenge. See full prize
 details at: http://p.sf.net/sfu/Challenge
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] rotating labels, what is wrong?!

2009-07-20 Thread John [H2O]



Jae-Joon Lee wrote:
 
 get_xmajorticklabels() returns a list of matplotlib's Text objects,
 not python strings.
 

This is what I've now come to understand, but it seems very odd. Why
wouldn't it return the list of strings, or alternatively, how can you get
the list of strings? I guess you have to use the pyplot tools, but I was
trying to use so called 'fine grain' control and do everything at the axes
level.



 
 plt.setp(plt.gca().get_xmajorticklabels(),
  size=6,rotation=30)
 

In fact, what you show is how I was testing in ipython and it does worked,
it just seemed in a script it would be better to use the axis method, but
apparently it is different from the gca() method. This is what I don't
understand.

Thanks!


On Mon, Jul 20, 2009 at 11:48 AM, John [H2O]washa...@gmail.com wrote:

 I am trying simply to shrink the font size and rotate xaxis labels:

 fig1 = plt.figure()
 ax1 = fig1.add_subplot(211)
 ax2 = fig1.add_subplot(212)
 ax1.plot_date(x,y,'r')
 ax1.set_xticklabels(plt.gca().get_xmajorticklabels(),
                    size=6,rotation=30)
 ax2.plot_date(o_X['time'],o_X['CO'],'y')
 ax2.set_xticklabels(plt.gca().get_xmajorticklabels(),
                     size=6,rotation=30)

 I end up with labels as:  (Text(0,0Text(0,0,))

 
 --
 View this message in context:
 http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24572302.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.


 --
 Enter the BlackBerry Developer Challenge
 This is your chance to win up to $100,000 in prizes! For a limited time,
 vendors submitting new applications to BlackBerry App World(TM) will have
 the opportunity to enter the BlackBerry Developer Challenge. See full
 prize
 details at: http://p.sf.net/sfu/Challenge
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users



-- 
View this message in context: 
http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24577287.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Having trouble with aligning subplots

2009-07-20 Thread Jae-Joon Lee
index for subplot starts from 1, not 0 (the convention is from Matlab).

Regards,

-JJ


On Mon, Jul 20, 2009 at 6:31 PM, W. Augustine Dunn
IIIwadun...@gmail.com wrote:
 Hello y'all:

 I am trying to plot a fig with three subplots.  However when I run my
 script the subplots are all shifted way too high
 (http://img.skitch.com/20090720-fp462u8ww4bq38j29u9bjtr2cx.png) and
 the top subplot is cut off.

 I tried doing something like this from reading another poster's thread
 but this did absolutely nothing:
 mpl.figure.SubplotParams(left=  (48 / 72.0) / figW,   # 48-point left 
 margin
  bottom=    (36 / 72.0) / figH,   # etc.
  right= 1 - (18 / 72.0) / figW,
  top=   1 - (12 / 72.0) / figH)

 Anyone have an idea how to fix this.

 Thank you for your time.

 Gus

 The code is below for those interested:
 code
 supTitle = 'Ortholog Pairs Matching Real or Control Ag miRNA seeds.'

 data = []
 for dFile in iFiles:
    data.append(pickle.load(open(dFile,'rU')))

 ks = []
 for i in range(len(data)):
    ks.append(sorted(data[i].keys()))

 for i in range(len(ks)):
    if !doc in ks[i]: ks[i].pop(0)  # if the pkl has a !doc entry.  pop it
    assert odd_or_even(len(ks[i])) == 'even', 'Error: len(ks[i]) must be even.'
 pos1Data = eval('[%s]' % ('[],'*len(data)))
 pos1Keys = eval('[%s]' % ('[],'*len(data)))
 pos2Data = eval('[%s]' % ('[],'*len(data)))
 pos2Keys = eval('[%s]' % ('[],'*len(data)))

 for i in range(len(ks)):
    for j in range(len(ks[i])):
        if odd_or_even(j) == 'even': # remember that we start with 0
 which is even.
            pos1Data[i].append(data[i][ks[i][j]])
            pos1Keys[i].append(ks[i][j])
        else:
            pos2Data[i].append(data[i][ks[i][j]])
            pos2Keys[i].append(ks[i][j])

 figW = 16
 figH = 8
 plt.figure(num=None, figsize=None, dpi=None, facecolor='w', edgecolor='k')
 subplotpars=mpl.figure.SubplotParams(left=      (48 / 72.0) / figW,
 # 48-point left margin
                                     bottom=    (36 / 72.0) / figH,   # etc.
                                     right= 1 - (18 / 72.0) / figW,
                                     top=   1 - (12 / 72.0) / figH)

 plt.suptitle(supTitle)
 for i in range(len(data)):
    matches1 = [x[0] for x in pos1Data[i]]
    ctrls1   = [-x[1] for x in pos1Data[i]]
    matches2 = [x[0] for x in pos2Data[i]]
    ctrls2   = [-x[1] for x in pos2Data[i]]

    assert len(matches1) == len(matches2), 'Error: matches1 and
 matches 2 do not have the same number of elements!'
    N = len(matches1)



    ind = np.arange(N)    # the x locations for the groups
    width = 0.35       # the width of the bars: can also be len(x) sequence


    plt.subplot(len(data),1,i,)
    p1 = plt.bar(ind, ctrls1,   width, color='w',)
    p2 = plt.bar(ind, matches1, width, color='b',)
    p3 = plt.bar(ind+width, ctrls2,   width, color='w',)
    p4 = plt.bar(ind+width, matches2, width, color='b', )
    plt.ylabel(subTitles[i])
    if i == len(data)-1:
        plt.xlabel('miRNA seed')

    axMax = max(matches1+matches2)*1.1
    axMin = min(ctrls1+ctrls2)*1.1
    #plt.axis([0,len(matches1),axMin,axMax])
    if i == 0:
        plt.legend( (p2[0], p1[0]), ('Real', 'Ctrls'), loc=(1.01,0.65) )
 /code

 --
 Enter the BlackBerry Developer Challenge
 This is your chance to win up to $100,000 in prizes! For a limited time,
 vendors submitting new applications to BlackBerry App World(TM) will have
 the opportunity to enter the BlackBerry Developer Challenge. See full prize
 details at: http://p.sf.net/sfu/Challenge
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users