Re: [Matplotlib-users] Matplotlib-users digest, Vol 1 #1206 - 2 msgs
Enjoy your trip Ma I need to look for a Bike Friday for Steve. He said he was interested/willing to think about loaded touring. He can be the mule! Jules ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Bike Friday and mules -- please disregard
Darned slow email tool; chose the wrong message Slow brain in checking actual "send to" address My apologies. Jules ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to remove padding around the drawing?
Title: How to remove padding around the drawing? Hi, when I'm plotting something in the most straightforward way, like from pylab import * plot([1,2,3]) title('A title') xlabel('foo') ylabel('bar') savefig('test.png') MPL produces an output file that has quite some padding around the drawing. Is there a way to remove that padding and only save the "true bounding box"? I know I can adjust that manually, but that would probably require constant tweaking if e.g. the font size of the labels and title changes. Cheers, Colin ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3d bar plots
"Jonathan" == Jonathan Taylor <[EMAIL PROTECTED]> writes: > > Hi, > > Was wondering if anyone knows if there was any way to > reproduce this kind of example: > > http://www.mps.mpg.de/dislin/exa_bars3d.html > > i.e. a 3d barplot. One alternative that exists is Qwt3d: http://qwtplot3d.sourceforge.net/ which apparently can do 3d barplots. http://qwtplot3d.sourceforge.net/images/venrichment.png Personally I'm not that familiar with that toolkit, but it does have python bindings, in conjunction with PyQt: http://pyqwt.sourceforge.net/ http://www.riverbankcomputing.co.uk/pyqt/index.php Glen ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3d bar plots
Hi Jonathan, A couple of people have suggested trying pyqwt. Since the answer is that matplotlib won't do it, why not just use DISLIN? Gary Jonathan Taylor wrote: > > Hi, > > Was wondering if anyone knows if there was any way to reproduce this > kind of > example: > > http://www.mps.mpg.de/dislin/exa_bars3d.html > > i.e. a 3d barplot. > > Thanks, > > Jonathan ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] histogram
Here it is. Have fun. Suggestions are welcome !David """Class constructor to compute weighted 1-D histogram. Usage: Histogram(data, bins=10, range=None, weights=None, normed=False) Input parameters -- data: Input array bins: Number of bins or the bin array(overides the range). range: A tuple of two values defining the lower and upper ends of the bin span. If no argument is given, defaults to (data.min(), data.max()). weights: Array of weights stating the importance of each data. This array must have the same shape as data. Methods --- add_data(values, weights): Add values array to existing data and update bin count. This does not modify the histogram bining. optimize_binning(method): Chooses an optimal number of bin. Available methods are : Freedman, Scott. score(percentile): Returns interpolated value at given percentile. cdf(x, method): Return interpolated cdf at x. Attributes - freq: The resulting bin count. If normed is true, this is a frequency. If normed is False, then freq is simply the number of data falling into each bin. cum_freq: The cumulative bin count. data: Array of data. weights: Array of weights. s_data: Array of sorted data. range : Bin limits : (min, max) Nbins : Number of bins bin : The bin array (Nbin + 1) normed: Normalization factor. Setting it to True will normed the density to 1. weighted : Boolean indicating whether or not the data is weighted. """ # License: MIT # Author: David Huard # Changes log # 2006, June 2: Completed object interface # May : Small corrections to docstrings # April : Modified to use objects # March : Creation # To do # Clean up the normed object in order to avoid calling __compute_cum_freq when it is changed. # Add a simple pdf method # Add 2D support from numpy import atleast_1d, linspace, ones, sort, Float, concatenate, diff, cross, array, size from scipy.interpolate import interp1d class Histogram(object): """Class constructor to compute weighted 1-D histogram. Usage: Histogram(data, bins=10, range=None, weights=None, normed=False) Input parameters --- data: Input array bins: Number of bins or the bin array(overides the range). range: A tuple of two values defining the lower and upper ends of the bin span. If no argument is given, defaults to (data.min(), data.max()). weights: Array of weights stating the importance of each data. This array must have the same shape as data. Methods - add_data(values, weights): Add values array to existing data and update bin count. This does not modify the histogram bining. optimize_binning(method): Chooses an optimal number of bin. Available methods are : Freedman, Scott. score(percentile): Returns interpolated value at given percentile. cdf(x, method): Return interpolated cdf at x. Attributes freq: The resulting bin count. If normed is true, this is a frequency. If normed is False, then freq is simply the number of data falling into each bin. cum_freq: The cumulative bin count. data: Array of data. weights: Array of weights. s_data: Array of sorted data. range : Bin limits : (min, max) Nbins : Number of bins bin : The bin array (Nbin + 1) normed: Normalization factor. Setting it to True will normed the density to 1. weighted : Boolean indicating whether or not the data is weighted. """ def __init__(self, data, bins=10, range=None, weights=None, normed=False): self.__Init = True self.weights = weights self.data = data self.range = range self.__normed = normed if size(bins) == 1: self.Nbins = bins else: self.bins = bins if range is not None: print 'The bin array assignment superseded the range assignment.' self.__compute() self.__empirical_cdf() self.__Init = False def __delete_value(self): """Delete method.""" raise TypeError, 'Cannot delete attribute.' def __set_value(self): raise TypeError, 'Cannot set attribute.' def range(): # range object doc = """A tuple of two values defining the lower and upper ends of the bin span. If no argument is given, defaults to (data.min(), data.max()).""" def fget(self): return self.__range def fset(self, value): if value is None: self.__range = array((self.__data.min(), self.__data.max()*(1+1E-6))) else: value = atleast
[Matplotlib-users] Question about the data path
I'm using matplotlib in an application I distribute. For Windows and Mac users I distribute a frozen application which includes python, matplotlib, etc. and I'm wondering how best to include the matplotlib data files. matplotlib searches for its data files in __init__._get_data_path. It seems to search shared locations first, then locations that would be relevant to a frozen application. Is that safe? I worry that if a user of my app has their own version of matplotlib (possibly a very different version than I've included) then the data files might be different. If this really is an issue, then what to do? For Mac I can put the data files deep in the app in Contents/Frameworks/Python.Framework/2.4/share/matplotlib, which is the second location looked at (after environment variable MATPLOTLIBDATA). For Windows, there doesn't seem any way out. The Windows frozen test is dead last. --- Also, should I worry about the user's local matplotlibrc file (which again might be for the wrong version or might never have been created or configured at all -- the main problem I've hit so far is that the auto-created default of this file is always wrong about the back end--picking gtkagg even though I don't even build gtk support). Again, that looks difficult or impossible because the search order is for the usual user locations first, then look in the data directory. Any advice would be most appreciated. -- Russell ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] can't get started
I have just installed numpy-0.9.8, scipy-0.4.9, and matplotlib-0.87.2 on a Windows machine with Python 2.4.2. When I import pylab, I get some Windows message box indicating an error in multiarray.pyd and am kicked out of interactive Python. Thanks for any advice? Peace, David S. ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] can't get started
David S. wrote: > I have just installed numpy-0.9.8, scipy-0.4.9, and matplotlib-0.87.2 on a > Windows machine with Python 2.4.2. > > When I import pylab, I get some Windows message box indicating an error in > multiarray.pyd and am kicked out of interactive Python. Please paste the exact error message here. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] can't get started
On 6/2/06, David S. <[EMAIL PROTECTED]> wrote: > I have just installed numpy-0.9.8, scipy-0.4.9, and matplotlib-0.87.2 on a > Windows machine with Python 2.4.2. matplotlib-0.87.2 requires numpy-0.9.6. You will get an error otherwise. ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Question about the data path
On 6/2/06, Russell E. Owen <[EMAIL PROTECTED]> wrote: > I'm using matplotlib in an application I distribute. For Windows and Mac > users I distribute a frozen application which includes python, > matplotlib, etc. and I'm wondering how best to include the matplotlib > data files. > > matplotlib searches for its data files in __init__._get_data_path. It > seems to search shared locations first, then locations that would be > relevant to a frozen application. Is that safe? I worry that if a user > of my app has their own version of matplotlib (possibly a very different > version than I've included) then the data files might be different. > > If this really is an issue, then what to do? The only way you could have conflicting data sources is if MATPLOTLIBDATA is defined in your environment. If someone is capable of setting that I am inclined to think they might know what to do in case of an error. If that env var is not set, then mpl looks inside the its module. Different installs will not see the others. We finally have a special case for frozen installations. It has primarily been made for py2exe, in which you should have a folder called 'matplotlibdata' in your app's bundle. > For Mac I can put the data files deep in the app in > Contents/Frameworks/Python.Framework/2.4/share/matplotlib, which is the > second location looked at (after environment variable MATPLOTLIBDATA). The second location should be: Frameworks/Python.Framework/2.4/lib/python2.4/matplotlib/mpl-data Are you using an old version of matplotlib? > For Windows, there doesn't seem any way out. The Windows frozen test is > dead last. You can remove the MATPLOTLIBDATA env var from os.environ in your code. > > --- > > Also, should I worry about the user's local matplotlibrc file (which > again might be for the wrong version or might never have been created or > configured at all -- the main problem I've hit so far is that the > auto-created default of this file is always wrong about the back > end--picking gtkagg even though I don't even build gtk support). > > Again, that looks difficult or impossible because the search order is > for the usual user locations first, then look in the data directory. In my experience with distributing apps with matplotlib, I have known in advanced the packages I want to use. For example, if I know I am going to bundle Tkinter and numpy, then I make sure I have the following before using any matplotlib commands. import matplotlib matplotlib.use('TkAgg') matplotlib.rcParams['numerix'] = 'numpy' This makes sure your app uses you desired backend modules no matter what the global config says. Good luck, Charlie ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users