Re: [Matplotlib-users] range for log scale

2009-09-21 Thread Janwillem

P.S.
I noted that the new versions of OOcalc and Exel, 3.0 and 2007, now do allow
log scales other than in decades.


Janwillem wrote:
 
 Is it possible to have in Matplotlib.pyplot a log (base 10) scale that 
 does go from xmin to xmax where xmin and xmax are not powers of 10 (as 
 in Excel and OOCalc)?? E.g. a scale from 20 to 2500 like you can do in 
 SciDAVis (and Origin and Mathematica) Scale/from  and Scale/to.
 I hope so,
 Thanks, Janwillem
 
 --
 Come build with us! The BlackBerryreg; Developer Conference in SF, CA
 is the only developer event you need to attend this year. Jumpstart your
 developing skills, take BlackBerry mobile applications to market and stay 
 ahead of the curve. Join us from November 9#45;12, 2009. Register
 now#33;
 http://p.sf.net/sfu/devconf
 ___
 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/range-for-log-scale-tp25529894p25530202.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Error in doc?

2009-09-21 Thread Matthias Michler
On Wednesday 09 September 2009 17:10:43 Jorge Scandaliaris wrote:
 Hi,
 I think I found a bug, but I am not sure if it's in the doc or in a method
 name. In the doc, there is reference to a method *suptitle* in class
 mpl.figure.Figure. The name sounds strange, but the method exists and
 works. The example given, though, makes reference to *subtitle*, so either
 the example or the method name are wrong. Here's the link to the doc:
 http://matplotlib.sourceforge.net/api/figure_api.html?highlight=legend#matp
lotlib.figure.Figure.suptitle

 jorge

Hi list,

I can confirm this difference for current SVN (Last Changed Rev: 7802, see 
attachement), too. 
Maybe some of the developers could correct the subtle error.

Kind regards,
Matthias

$ svn info
Path: .
URL: https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib
Repository Root: https://matplotlib.svn.sourceforge.net/svnroot/matplotlib
Repository UUID: f61c4167-ca0d-0410-bb4a-bb21726e55ed
Revision: 7802
Node Kind: directory
Schedule: normal
Last Changed Author: jdh2358
Last Changed Rev: 7802
Last Changed Date: 2009-09-21 00:10:07 +0200 (Mon, 21 Sep 2009)


SUBTITLE :
---

./lib/matplotlib/figure.py:303:  fig.subtitle('this is the figure 
title', fontsize=12)
./build/lib.linux-i686-2.5/matplotlib/figure.py:302:  
fig.subtitle('this is the figure title', fontsize=12)


SUPTITLE :
---

./doc/pyplots/text_commands.py:5:fig.suptitle('bold figure suptitle', 
fontsize=14, fontweight='bold')
./lib/matplotlib/pyplot.py:392:@docstring.copy_dedent(Figure.suptitle)
./lib/matplotlib/pyplot.py:393:def suptitle(*args, **kwargs):
./lib/matplotlib/pyplot.py:394:ret =  gcf().suptitle(*args, **kwargs)
./lib/matplotlib/pylab.py:83:  suptitle   - add a figure title
./lib/matplotlib/figure.py:280:def suptitle(self, t, **kwargs):
./examples/event_handling/figure_axes_enter_leave.py:28:fig1.suptitle('mouse 
hover over figure or axes to trigger events')
./examples/event_handling/figure_axes_enter_leave.py:38:fig2.suptitle('mouse 
hover over figure or axes to trigger events')
./examples/pylab_examples/custom_cmap.py:165:plt.suptitle('Custom Blue-Red 
colormaps')
./examples/pylab_examples/figure_title.py:19:suptitle('This is a somewhat long 
figure title', fontsize=16)
./examples/pylab_examples/image_nonuniform.py:20:fig.suptitle('NonUniformImage 
class')
./build/lib.linux-i686-2.5/matplotlib/pyplot.py:398:def suptitle(*args, 
**kwargs):
./build/lib.linux-i686-2.5/matplotlib/pyplot.py:399:ret =  
gcf().suptitle(*args, **kwargs)
./build/lib.linux-i686-2.5/matplotlib/pyplot.py:402:if Figure.suptitle.__doc__ 
is not None:
./build/lib.linux-i686-2.5/matplotlib/pyplot.py:403:suptitle.__doc__ = 
dedent(Figure.suptitle.__doc__)
./build/lib.linux-i686-2.5/matplotlib/pylab.py:83:  suptitle   - add a figure 
title
./build/lib.linux-i686-2.5/matplotlib/figure.py:279:def suptitle(self, t, 
**kwargs):
--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plot of 2D array without masked values?

2009-09-21 Thread Christian Meesters
Hi,

I'm plotting 2D-ndarrays with pylab.pcolor(). The data contain masked
values and it can happen that entire rows or columns hold only masked
values. Is there a build-in way to omitted such rows/columns? Currently
I'm removing the labels in x and y and the row/columns by hand.

TIA
Christian


--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Error in doc?

2009-09-21 Thread Ryan May
On Mon, Sep 21, 2009 at 5:13 AM, Matthias Michler
matthiasmich...@gmx.netwrote:

 On Wednesday 09 September 2009 17:10:43 Jorge Scandaliaris wrote:
  Hi,
  I think I found a bug, but I am not sure if it's in the doc or in a
 method
  name. In the doc, there is reference to a method *suptitle* in class
  mpl.figure.Figure. The name sounds strange, but the method exists and
  works. The example given, though, makes reference to *subtitle*, so
 either
  the example or the method name are wrong. Here's the link to the doc:
 
 http://matplotlib.sourceforge.net/api/figure_api.html?highlight=legend#matp
 lotlib.figure.Figure.suptitle
 
  jorge

 Hi list,

 I can confirm this difference for current SVN (Last Changed Rev: 7802, see
 attachement), too.
 Maybe some of the developers could correct the subtle error.


Done.  suptitle is the correct name, as it's kind of a super title that
appears at the top of a figure with multiple panels, not a subtitle.

Thanks for catching this.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Piecewise Cubic Hermite Interpolating Polynomial in python

2009-09-21 Thread rbessa

Chris,
regarding the print statements in the function you may want to use something
like:
total_matches = (xx == x).sum()
if total_matches != n:
raise ValueError(x values weren't in sorted order)

I also have one question:
in function pchip_eval instead of  t = (xvec - x[k]) / h[k] should not
be t = (xvec - x[k]) / h ?

Best regards,
Ricardo Bessa



Chris Michalski-3 wrote:
 
 Recently, I had a need for a monotonic piece-wise cubic Hermite  
 interpolator.   Matlab provides the function pchip (Piecewise Cubic  
 Hermite Interpolator), but when I Googled I didn't find any Python  
 equivalent.   I tried interp1d() from scipy.interpolate but this was  
 a standard cubic spline using all of the data - not a piece-wise cubic  
 spline.
 
 I had access to Matlab documentation, so I spent a some time tracing  
 through the code to figure out how I might write a Python duplicate.   
 This was an massive exercise in frustration and a potent reminder on  
 why I love Python and use Matlab only under duress.  I find typical  
 Matlab code is poorly documented (if at all) and that apparently  
 includes the code included in their official releases.  I also find  
 Matlab syntax “dated” and the code very difficult to “read”.
 
 Wikipedia to the rescue.
 
 Not to be deterred, I found a couple of very well written Wikipedia  
 entries, which explained in simple language how to compute the  
 interpolant.  Hats off to whoever wrote these entries – they are  
 excellent.  The result was a surprising small amount of code  
 considering the Matlab code was approaching 10 pages of  
 incomprehensible code. Again - strong evidence that things are just  
 better in Python...
 
 Offered for those who might have the same need – a Python pchip()  
 equivalent == pypchip().  Since I'm not sure how attachments work (or  
 if they work at all...), I copied the code I used below, followed by a  
 PNG showing success:
 
 #
 #pychip.py
 #Michalski
 #20090818
 #
 #Piecewise cubic Hermite interpolation (monotonic...) in Python
 #
 #References:
 #
 #Wikipedia:  Monotone cubic interpolation
 #Cubic Hermite spline
 #
 #A cubic Hermte spline is a third degree spline with each  
 polynomial of the spline
 #in Hermite form.  The Hermite form consists of two control points  
 and two control
 #tangents for each polynomial.  Each interpolation is performed on  
 one sub-interval
 #at a time (piece-wise).  A monotone cubic interpolation is a  
 variant of cubic
 #interpolation that preserves monotonicity of the data to be  
 interpolated (in other
 #words, it controls overshoot).  Monotonicity is preserved by  
 linear interpolation
 #but not by cubic interpolation.
 #
 #Use:
 #
 #There are two separate calls, the first call, pchip_init(),  
 computes the slopes that
 #the interpolator needs.  If there are a large number of points to  
 compute,
 #it is more efficient to compute the slopes once, rather than for  
 every point
 #being evaluated.  The second call, pchip_eval(), takes the slopes  
 computed by
 #pchip_init() along with X, Y, and a vector of desired xnews and  
 computes a vector
 #of ynews.  If only a handful of points is needed, pchip() is a  
 third function
 #which combines a call to pchip_init() followed by pchip_eval().
 #
 
 import pylab as P
 
 #=
 def pchip(x, y, xnew):
 
  # Compute the slopes used by the piecewise cubic Hermite  
 interpolator
  m= pchip_init(x, y)
 
  # Use these slopes (along with the Hermite basis function) to  
 interpolate
  ynew = pchip_eval(x, y, xnew)
 
  return ynew
 
 #=
 def x_is_okay(x,xvec):
 
  # Make sure x and xvec satisfy the conditions for
  # running the pchip interpolator
 
  n = len(x)
  m = len(xvec)
 
  # Make sure x is in sorted order (brute force, but works...)
  xx = x.copy()
  xx.sort()
  total_matches = (xx == x).sum()
  if total_matches != n:
  print * * 50
  print x_is_okay()
  print x values weren't in sorted order --- aborting
  return False
 
  # Make sure 'x' doesn't have any repeated values
  delta = x[1:] - x[:-1]
  if (delta == 0.0).any():
  print * * 50
  print x_is_okay()
  print x values weren't monotonic--- aborting
  return False
 
  # Check for in-range xvec values (beyond upper edge)
  check = xvec  x[-1]
  if check.any():
  print * * 50
  print x_is_okay()
  print Certain 'xvec' values are beyond the upper end of 'x'
  print x_max = , x[-1]
  indices = P.compress(check, range(m))
  print out-of-range xvec's = , xvec[indices]
  print out-of-range xvec indices = , indices
  return False
 
  # Second - 

Re: [Matplotlib-users] Changing edge colour of scatterplot

2009-09-21 Thread Jae-Joon Lee
On Sun, Sep 20, 2009 at 11:45 PM, bwgoudey bwgou...@gmail.com wrote:

 I'm trying to draw a scatter plot where each point is a different colour and
 is only a single pixel. Unfortunately at the minute, while I can change the
 colour and size, I haven't been able to remove the edges of the markers and
 my single pixel becomes the colour of the edge. I've attached some sample
 code below. Can anyway see what I've done wrong? It currently just gives
 back an error.


Your code works as expected with the current svn head. If you're using
older version of mpl, can you try to update and see if it solves the
problem?
If you're using recent version of mpl, please post an error message you got.

 And a related question. Is using scatter the best way to draw a plot of
 single pixels? Or would it be more efficient to use one of the more
 primitive classes to do this?


matplotlib basically creates a vector-based plot, and a notion of
single-pixel is not very meaningful. While it makes some sense for
raster output formats like png, but still, the result depends on the
dpi of your output. Note that unit for the parameter s in the
scatter function is in points(**2). 1 points corresponds to one pixel
in dpi=72. With higher dpi, the scatter points will occupy more than a
single pixel.

Regards,

-JJ



 fig = plt.figure()
 ax = fig.add_subplot(111)

 x=[1,2,3,4]
 y=[2,3,5,4]
 s=1
 c=[0.4, 0.2, 0.3, 0.5]

 prop=dict(edgecolors='none')
 ax.scatter(x,y, s=s, c=c, **prop)
 plt.show()
 --
 View this message in context: 
 http://www.nabble.com/Changing-edge-colour-of-scatterplot-tp25530171p25530171.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.


 --
 Come build with us! The BlackBerryreg; Developer Conference in SF, CA
 is the only developer event you need to attend this year. Jumpstart your
 developing skills, take BlackBerry mobile applications to market and stay
 ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
 http://p.sf.net/sfu/devconf
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users