Re: [Matplotlib-users] Format date tick labels

2012-10-12 Thread Damon McDougall
On Thursday, October 11, 2012, Benjamin Root wrote:



 On Thu, Oct 11, 2012 at 4:53 PM, Mark Lawrence 
 breamore...@yahoo.co.ukjavascript:_e({}, 'cvml', 
 'breamore...@yahoo.co.uk');
  wrote:

 On 11/10/2012 10:55, Damon McDougall wrote:
  On Wed, Oct 10, 2012 at 5:00 PM, Benjamin Root 
  ben.r...@ou.edujavascript:_e({}, 'cvml', 'ben.r...@ou.edu');
 wrote:
 
 
  On Wed, Oct 10, 2012 at 10:55 AM, Mark Lawrence 
 breamore...@yahoo.co.uk javascript:_e({}, 'cvml',
 'breamore...@yahoo.co.uk');
  wrote:
 
  On 10/10/2012 15:41, Mark Lawrence wrote:
  On 10/10/2012 14:29, Benjamin Root wrote:
 
  I know of a few people who have difficulties with matplotlib's
 datetime
  handling, but they are usually operating on the scale of
 milliseconds
  or
  less (lightning data), in which case, one is already at the edge of
 the
  resolution handled by python's datetime objects.  However, we would
  certainly welcome any sort of examples of how matplotlib fails in
  handling
  seconds scale and lower plots.
 
  Cheers!
  Ben Root
 
 
 
  I'll assume that the milliseconds above is a typo.  From
  http://docs.python.org/library/datetime.html class
 datetime.timedelta A
  duration expressing the difference between two date, time, or
 datetime
  instances to microsecond resolution.  Still, what's a factor of 1000
  amongst friends? :)
 
 
  http://www.python.org/dev/peps/pep-0418/ has been implemented in
 Python
  3.3 and talks about clocks with nanosecond resolutions.  I've flagged
 it
  up here just in case people weren't aware.
 
 
  Ah, you are right, I meant microseconds.
 
  With apologies to Spaceballs:
 
  Prepare to go to microsecond resolution!
  No, no, microsecond resolution is too slow
  Microsecond resolution is too slow?
  Yes, too slow. We must use nanosecond resolution!
  Prep-- Prepare Python, for nanosecond resolution!
 
  Cheers!
  Ben Root
 
  Am I missing something here? Are seconds just floats internally? A
  delta of 1e-6 is nothing (pardon the pun). A delta of 1e-9 is the
  *least* I'd expect. Maybe even 1e-12. Perhaps the python interpreter
  doesn't do any denormalising
 http://stackoverflow.com/questions/9314534/why-does-changing-0-1f-to-0-slow-down-performance-by-10x
 
  when encountered with deltas very close to zero...
 

 What percentage of computer users wants a delta of 1e-12?  I suspect
 that the vast majority of users couldn't care two hoots about miniscule
 time deltas in a world where changing time zones can cause chaos.  Where
 some applications cannot handle years before 1970, or 1904, or 1900 or
 whatever.  Or they can't go too far forward, 2036 I think but don't
 quote me.  Where people like myself had to put a huge amount of effort
 into changing code so that applications would carry on working when the
 date flipped over from 31st December 1999 to 1st January 2000.  If
 things were that simple why is matplotlib using third party modules like
 dateutil and pytz?  Why doesn't the batteries included Python already
 provide this functionality?


 Preach on, my brother! Preach on!

 [psst -- you are facing the choir...]

 Cheers!
 Ben Root


Clearly I have misunderstood something and hit a nerve. Apologies.


-- 
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] color pallette suggestions wanted

2012-10-12 Thread Andreas Hilboll
Hi,

I have some data I want to plot using pcolormesh. It's 2d climatological
data, see the attached plot. My data is in a range from -7 to +0.6. I want
to be 0.0 to be clearly visible, while at the same time, the color range
should show the full dynamic of the values. I played with the bwr and
seismic color maps, centering on zero, so that white is 0.0. However, I'm
not too happy with the dynamic range I get in the negative.

Any suggestions are very welcome ...

Cheers, Andreas.attachment: example.png--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] x-label location not at xtick location?

2012-10-12 Thread Andreas Hilboll
Hi,

another question. Given the plot from my last email (I attached the code
to this one as well), I would like to have the x-labels (J, F, ...)
not at the location of the xticks, but centered in between to xticks. I
would then move the xticks so that they form the bins to the data chunks,
and the labels should be where the current xticks are.

Any suggestions are again extremely welcome :)

Cheers, Andreas.from numpy import arange, linspace, where, searchsorted, zeros, nan, loadtxt, asarray, random
from numpy.ma import masked_invalid
import matplotlib.pyplot as plt

data = random.randn(12,72)

nxbin, nybin = data.shape
xbin = linspace(0, 12, nxbin + 1)
ybin = linspace(-90, 90, nybin + 1)
pdata = masked_invalid(data)

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

cmap = mpl.cm.seismic
cmap.set_bad('#cc', 1.)

pl = spl.pcolormesh(xbin, ybin, pdata.T,
cmap=cmap, edgecolors='None',
vmin=-7,vmax=7,
)
spl.axis([0., 12., ybin.min(), ybin.max()])

spl.set_xticks(xbin[1:]-.5)
spl.set_xticklabels(['J','F','M','A','M','J','J','A','S','O','N','D'],
size='large')
spl.set_xlim([0.,12.])
spl.set_xlabel(u'Month', size='x-large', fontname='Arial')

spl.set_ylabel(u'Latitude [°]', size='x-large', fontname='Arial')
spl.set_yticks(linspace(-90., 90., 7))
spl.set_yticklabels(arange(-90,91,30), size='large', fontname='Arial')

cb = plt.colorbar(mappable=pl, orientation='horizontal',
  fraction=0.075, aspect=50, pad=.15)
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] xlabels on top, ylabels on right

2012-10-12 Thread Andreas Hilboll
Hi, me again :)

I'm looking for a way to have the xlabels on the top (instead of bottom),
and the ylabels on the right (instead of left). I guess I could do
something with twinx / twiny and just not use the left/bottom axis, but
I'm sure there is some more elegant way ...

Cheers, Andreas.


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xlabels on top, ylabels on right

2012-10-12 Thread Andreas Hilboll
 Hi, me again :)

 I'm looking for a way to have the xlabels on the top (instead of bottom),
 and the ylabels on the right (instead of left). I guess I could do
 something with twinx / twiny and just not use the left/bottom axis, but
 I'm sure there is some more elegant way ...

I need to correct myself: I want the xticklabels / yticklabels to be on
top/right.


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Accessing WMS and ESRI REST services in Matplotlib

2012-10-12 Thread Rich Signell
WMS services are required to respond to  GetCapabiltiies request,
reporting what layers, styles, times, elevations, and projections they
have available.  So for example, using the Unidata WMS example below,
if we do:

 
http://motherlode.ucar.edu:8080/thredds/wms/fmrc/NCEP/NAM/CONUS_12km/NCEP-NAM-CONUS_12km-noaaport_best.ncd?service=WMSrequest=GetCapabilities

we can see from the XML response that the Coordinate Reference Systems
supported are:

CRSEPSG:4326/CRS
CRSCRS:84/CRS
CRSEPSG:41001/CRS
CRSEPSG:3857/CRS
CRSEPSG:27700/CRS
CRSEPSG:3408/CRS
CRSEPSG:3409/CRS
CRSEPSG:32661/CRS
CRSEPSG:32761/CRS

And for this server, the supported response types are:
Formatimage/jpeg/Format
Formatimage/png/Format
Formatapplication/vnd.google-earth.kmz/Format
Formatimage/gif/Format

So I guess one way to proceed if you wanted to use WMS in Matplotlib
and avoid reprojection in python would be to:
1. do the WMS GetCapabilities request to find the available supported
Coordinate Reference Systems (which will vary with WMS server)
2. setup Basemap to use one of these CRS
3. use the bounding box of your current axis (in projection units) as
part of a GetMap request to the WMS.

-Rich

On Thu, Oct 11, 2012 at 12:16 AM, klo uo klo...@gmail.com wrote:
 I guess that's it?

 warpimage() as it is now, checks if passed image is url, so we can add
 additional check if image is url, with urlparse to deduce image coordinates
 and projection if present, then overlay it over already created Basemap
 object.

 --
 Don't let slow site performance ruin your business. Deploy New Relic APM
 Deploy New Relic app performance management and know exactly
 what is happening inside your Ruby, Python, PHP, Java, and .NET app
 Try New Relic at no cost today and get our sweet Data Nerd shirt too!
 http://p.sf.net/sfu/newrelic-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
Dr. Richard P. Signell   (508) 457-2229
USGS, 384 Woods Hole Rd.
Woods Hole, MA 02543-1598

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xlabels on top, ylabels on right

2012-10-12 Thread Benjamin Root
On Fri, Oct 12, 2012 at 6:12 AM, Andreas Hilboll li...@hilboll.de wrote:

  Hi, me again :)
 
  I'm looking for a way to have the xlabels on the top (instead of bottom),
  and the ylabels on the right (instead of left). I guess I could do
  something with twinx / twiny and just not use the left/bottom axis, but
  I'm sure there is some more elegant way ...

 I need to correct myself: I want the xticklabels / yticklabels to be on
 top/right.


I believe you are looking for tick_params():
http://matplotlib.org/api/axes_api.html?highlight=tick_param#matplotlib.axes.Axes.tick_params

ax.tick_params(axis='x', labelbottom=False, labeltop=True)
ax.tick_params(axis='y', labelleft=False, labelright=True)

Cheers!
Ben Root
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] dpi

2012-10-12 Thread Nikolaus Rath
Jae-Joon Lee lee.j.joon-re5jqeeqqe8avxtiumw...@public.gmane.org writes:
 On Fri, Oct 12, 2012 at 3:39 AM, Nikolaus Rath 
 nikolaus-bth8mxji...@public.gmane.org wrote:
 matplotlib actually rescales the raw imshow data when saving to a vector
 format? Why is that? I think it should embed the bitmap with full
 resolution in the vector file and rely on the consumer of the vector
 file to scale it to whatever resolution is supported by the display
 device.

 imshow supports interpolation and that's why rasterization comes in.
 If you turn off interpolation (w/ interpolation=none), the original
 image will be embedded. Of course dpi has no meaning in this case.

 However, I agree with you that dpi should be a property of the backend
 only, not the figure. But I am not sure if this can be fixed soon. It
 will be difficult and will take lots of effort I think.

Yeah, that's what I feared. But in the mean time, are there any best
practices to minimize undesired effects like the one above? For example,
are there any other functions that need special parameters to not raster
their output when writing to a vector format? And is there a way to get
a figure on the screen with the right size when I don't know what dpi
the monitor is running with?

Best,

   -Nikolaus

-- 
 »Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xlabels on top, ylabels on right

2012-10-12 Thread Andreas Hilboll
  Hi, me again :)
 
  I'm looking for a way to have the xlabels on the top (instead of
 bottom),
  and the ylabels on the right (instead of left). I guess I could do
  something with twinx / twiny and just not use the left/bottom axis,
 but
  I'm sure there is some more elegant way ...

 I need to correct myself: I want the xticklabels / yticklabels to be on
 top/right.


 I believe you are looking for tick_params():
 http://matplotlib.org/api/axes_api.html?highlight=tick_param#matplotlib.axes.Axes.tick_params

 ax.tick_params(axis='x', labelbottom=False, labeltop=True)
 ax.tick_params(axis='y', labelleft=False, labelright=True)

Yes, that's it, Ben. Thanks!



--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Format date tick labels

2012-10-12 Thread Ethan Gutmann

On Oct 11, 2012, at 2:58 PM, Benjamin Root wrote:
 
 On Thu, Oct 11, 2012 at 4:53 PM, Mark Lawrence breamore...@yahoo.co.uk 
 wrote:
 On 11/10/2012 10:55, Damon McDougall wrote:
 
  Am I missing something here? Are seconds just floats internally? A
  delta of 1e-6 is nothing (pardon the pun). A delta of 1e-9 is the
  *least* I'd expect. Maybe even 1e-12. Perhaps the python interpreter
  doesn't do any 
  denormalisinghttp://stackoverflow.com/questions/9314534/why-does-changing-0-1f-to-0-slow-down-performance-by-10x
  when encountered with deltas very close to zero...
 
 
 What percentage of computer users wants a delta of 1e-12?  I suspect
 that the vast majority of users couldn't care two hoots about miniscule
 
 
 Preach on, my brother! Preach on!
 
 [psst -- you are facing the choir...]


I'm a little confused by this attitude.  I recognize that there are issues 
around dates, I've written a few date libraries myself to get around insane 
excel date issues (pop quiz for anyone at MS, was 1900 a leap year?) or just to 
simplify APIs for my own use.  But do neither of you think that nanoseconds are 
important to scientists?  I know of enough projects that work with pico (and a 
few with femto) seconds.  Even though I often work with climate data covering 
~100s of years and used to work with geologic data covering ~billions of years, 
I may start working with raw laser data for distance measurements where 
nanoseconds can be a pretty big deal.  These data would be collected over a few 
years time, so a date utility that can handle that scale range would be useful. 
 I guess I'll be writing my own date/time library again and hacking together 
some way of plotting data in a meaningful way in matplotlib.  

Don't get me wrong, matplotlib shouldn't have to reinvent the wheel here, but 
claiming that nobody could possibly care about 1e-12 seconds seems a little 
provincial.  My apologies if that is not how the above statements were 
intended.  

regards,
Ethan--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Format date tick labels

2012-10-12 Thread Benjamin Root
On Friday, October 12, 2012, Ethan Gutmann wrote:


 On Oct 11, 2012, at 2:58 PM, Benjamin Root wrote:


 On Thu, Oct 11, 2012 at 4:53 PM, Mark Lawrence 
 breamore...@yahoo.co.ukjavascript:_e({}, 'cvml', 
 'breamore...@yahoo.co.uk');
  wrote:

 On 11/10/2012 10:55, Damon McDougall wrote:

  Am I missing something here? Are seconds just floats internally? A
  delta of 1e-6 is nothing (pardon the pun). A delta of 1e-9 is the
  *least* I'd expect. Maybe even 1e-12. Perhaps the python interpreter
  doesn't do any denormalising
 http://stackoverflow.com/questions/9314534/why-does-changing-0-1f-to-0-slow-down-performance-by-10x
 
  when encountered with deltas very close to zero...
 

 What percentage of computer users wants a delta of 1e-12?  I suspect
 that the vast majority of users couldn't care two hoots about miniscule


 Preach on, my brother! Preach on!

 [psst -- you are facing the choir...]



 I'm a little confused by this attitude.  I recognize that there are issues
 around dates, I've written a few date libraries myself to get around insane
 excel date issues (pop quiz for anyone at MS, was 1900 a leap year?) or
 just to simplify APIs for my own use.  But do neither of you think that
 nanoseconds are important to scientists?  I know of enough projects that
 work with pico (and a few with femto) seconds.  Even though I often work
 with climate data covering ~100s of years and used to work with geologic
 data covering ~billions of years, I may start working with raw laser data
 for distance measurements where nanoseconds can be a pretty big deal.
  These data would be collected over a few years time, so a date utility
 that can handle that scale range would be useful.  I guess I'll be writing
 my own date/time library again and hacking together some way of plotting
 data in a meaningful way in matplotlib.

 Don't get me wrong, matplotlib shouldn't have to reinvent the wheel here,
 but claiming that nobody could possibly care about 1e-12 seconds seems a
 little provincial.  My apologies if that is not how the above statements
 were intended.

 regards,
 Ethan


Oh, don't get me wrong, those time scales are important.  I was merely
expressing my dismay over the amount of problems that exists in the set of
tools for everyday use.  It is 2012, and Perl still has probably the best
datetime library out there...

Python can do much better.

Ben Root
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Format date tick labels

2012-10-12 Thread Mark Lawrence
On 12/10/2012 20:38, Ethan Gutmann wrote:

 I'm a little confused by this attitude.  I recognize that there are issues 
 around dates, I've written a few date libraries myself to get around insane 
 excel date issues (pop quiz for anyone at MS, was 1900 a leap year?) or just 
 to simplify APIs for my own use.  But do neither of you think that 
 nanoseconds are important to scientists?  I know of enough projects that work 
 with pico (and a few with femto) seconds.  Even though I often work with 
 climate data covering ~100s of years and used to work with geologic data 
 covering ~billions of years, I may start working with raw laser data for 
 distance measurements where nanoseconds can be a pretty big deal.  These data 
 would be collected over a few years time, so a date utility that can handle 
 that scale range would be useful.  I guess I'll be writing my own date/time 
 library again and hacking together some way of plotting data in a meaningful 
 way in matplotlib.

 Don't get me wrong, matplotlib shouldn't have to reinvent the wheel here, but 
 claiming that nobody could possibly care about 1e-12 seconds seems a little 
 provincial.  My apologies if that is not how the above statements were 
 intended.

 regards,
 Ethan



I actually said What percentage of computer users wants a delta of 
1e-12?  I suspect that the vast majority of users couldn't care two 
hoots about miniscule time deltas in a world where changing time zones 
can cause chaos

How does this translate into claiming that nobody could possibly care 
about 1e-12 seconds seems a little provincial?

-- 
Cheers.

Mark Lawrence.


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Format date tick labels

2012-10-12 Thread Ethan Gutmann
On Oct 12, 2012, at 4:15 PM, Mark Lawrence wrote:

 On 12/10/2012 20:38, Ethan Gutmann wrote:
 
 I'm a little confused by this attitude.  I recognize that there are issues 
 around dates, I've written a few date libraries myself to get around insane 
 excel date issues (pop quiz for anyone at MS, was 1900 a leap year?) or just 
 to simplify APIs for my own use.  But do neither of you think that 
 nanoseconds are important to scientists?  I know of enough projects that 
 work with pico (and a few with femto) seconds.  Even though I often work 
 with climate data covering ~100s of years and used to work with geologic 
 data covering ~billions of years, I may start working with raw laser data 
 for distance measurements where nanoseconds can be a pretty big deal.  These 
 data would be collected over a few years time, so a date utility that can 
 handle that scale range would be useful.  I guess I'll be writing my own 
 date/time library again and hacking together some way of plotting data in a 
 meaningful way in matplotlib.
 
 Don't get me wrong, matplotlib shouldn't have to reinvent the wheel here, 
 but claiming that nobody could possibly care about 1e-12 seconds seems a 
 little provincial.  My apologies if that is not how the above statements 
 were intended.
 
 regards,
 Ethan
 
 
 
 I actually said What percentage of computer users wants a delta of 
 1e-12?  I suspect that the vast majority of users couldn't care two 
 hoots about miniscule time deltas in a world where changing time zones 
 can cause chaos
 
 How does this translate into claiming that nobody could possibly care 
 about 1e-12 seconds seems a little provincial?
 
 -- 
 Cheers.
 
 Mark Lawrence.

Like I said, my apologies if I mis-interpreted.  To me the statement the vast 
majority of users couldn't care two hoots... *implies* since almost nobody 
needs this we won't worry about it, especially when it is in response to 
someone who felt this was an important feature: 
A delta of 1e-9 is the *least* I'd expect. Maybe even 1e-12. .  
My response was as much an issue with how I perceived the tone as anything else 
(obviously, tone doesn't cary well over email ;) )  

Don't get me wrong, I realize there are bigger fish to fry.  I just want add a 
vote that 1E-12 seconds (and less) can indeed be important to a significant 
number of people.  I suspect that many experimental physicists would be unable 
to use a time utility that can't handle those timescales.  Many of them will 
simply write there own utility, but then if they start running into any of the 
longer time scale issues e.g. leap years/seconds etc. they end up having to 
reinvent the wheel.  Others have also pointed out that databases[1], network 
packets and stock trading transactions[2] may care about nanoseconds.  

[1]http://code.activestate.com/lists/python-dev/117090/
[2]http://code.activestate.com/lists/python-dev/117091/

I'm glad to see that others are thinking about this and that future python 
versions may get down to nanosecond (or better?) resolution, though I haven't 
found the PEP for it yet.  Guido seems to have given his approval for more work 
on the matter at least : http://code.activestate.com/lists/python-dev/117147/  

PEP 418 mentioned before doesn't mention the date time class as far as I can 
tell.  http://www.python.org/dev/peps/pep-0418/ 

regards,
Ethan


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] color pallette suggestions wanted

2012-10-12 Thread Ryan Nelson
Andreas,

Perhaps you would be better off making your own colormap considering that
your data is not symmetric around zero. You could do something like the
following:

--
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as plc

data = np.random.randn(12,72)
data = data*5. - 5.

zero =  -1*data.min()/(data.max() - data.min())

cdict = {'red':   [(0.0, 1.0, 1.0),
  (zero, 1.0, 1.0),
  (1.0, 0.0, 0.0)],
 'green': [(0.0, 0.0, 0.0),
  (zero, 1.0, 1.0),
  (1.0, 0.0, 0.0)],
 'blue':  [(0.0, 0.0, 0.0),
  (zero, 1.0, 1.0),
  (1.0, 1.0, 0.0)],
 }

cmap = plc.LinearSegmentedColormap('cmap', cdict, N=1000)
mappable = plt.cm.ScalarMappable(cmap=cmap)
mappable.set_array(data)

fig = plt.figure()
plt.pcolormesh(data, cmap=cmap)
fig.colorbar(mappable)

plt.show()
--

Of course, the zero calculation assumes that zero actually exists in your
data set. That can be fixed with a simple if...else statement if you want
this to be more robust.

You can get rid of a few lines from this code if you don't want to set a
ScalarMappable object. However, I was doing some stuff with line
collections where I wanted some colors to have an alpha associated with
them, and I found that I was losing that info with the simpler pyplot
interface for colorbar generation. So I left in the slightly more complex
code for reference. (This might be changed in newer versions of mpl, I just
haven't needed to rework my code to check.)

Ryan

On Fri, Oct 12, 2012 at 4:17 AM, Andreas Hilboll li...@hilboll.de wrote:

 Hi,

 I have some data I want to plot using pcolormesh. It's 2d climatological
 data, see the attached plot. My data is in a range from -7 to +0.6. I want
 to be 0.0 to be clearly visible, while at the same time, the color range
 should show the full dynamic of the values. I played with the bwr and
 seismic color maps, centering on zero, so that white is 0.0. However, I'm
 not too happy with the dynamic range I get in the negative.

 Any suggestions are very welcome ...

 Cheers, Andreas.

 --
 Don't let slow site performance ruin your business. Deploy New Relic APM
 Deploy New Relic app performance management and know exactly
 what is happening inside your Ruby, Python, PHP, Java, and .NET app
 Try New Relic at no cost today and get our sweet Data Nerd shirt too!
 http://p.sf.net/sfu/newrelic-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Fwd: color pallette suggestions wanted

2012-10-12 Thread Damon McDougall
Forgot to reply all.

-- Forwarded message --
From: *Damon McDougall*
Date: Friday, October 12, 2012
Subject: [Matplotlib-users] color pallette suggestions wanted
To: Andreas Hilboll li...@hilboll.de


On Fri, Oct 12, 2012 at 10:17 AM, Andreas Hilboll
li...@hilboll.dejavascript:;
wrote:
 Hi,

 I have some data I want to plot using pcolormesh. It's 2d climatological
 data, see the attached plot. My data is in a range from -7 to +0.6. I want
 to be 0.0 to be clearly visible, while at the same time, the color range
 should show the full dynamic of the values. I played with the bwr and
 seismic color maps, centering on zero, so that white is 0.0. However, I'm
 not too happy with the dynamic range I get in the negative.

Your data is not symmetric about zero, so you will always get a result
the looks 'too dynamic' in the negative values (that is, if you want
to use the whole colour map range). You need to make a sacrifice
somewhere to get the effect you want.

1) Move your data so it's symmetric around zero, that way you'll get a
nice dynamic change, but the position of 'zero' will be less clear.

2) Don't move your data and use a truncated colour map. That way the
position of 'zero' will be clear but you'll get less dynamic change in
the negative values.

Hope this helps.

Best,
Damon

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom



-- 
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users