Re: [matplotlib-devel] adding second formatter/locater set to axes objects

2013-05-24 Thread James Evans
For what it is worth, we attacked this problem about four years ago at my
work.  We just implemented a simple formatter.  A locator can also be done
in a similar manner if that is desired.

This is not exactly is a perfect solution, but it worked really well for us.

class ScaledFormatter( ticker.Formatter ):
   """: Takes an exisiting formatter and scales the value by a specified
amount.
   """
   def __init__( self, scale, formatter ):
  """Initialize the scaled formatter.

  = INPUT VARIABLES
  - scale The scale factor to apply to the values specified by the
  other formatter.
  - formatter Another matplotlib formatter to use for formatting the
  data labels.
  """
  self.scale = scale
  self.formatter = formatter

   def __call__( self, x, pos = None ):
  'Return the format for tick val x at position pos'
  # get the string form of the value
  valueStr = self.formatter( x, pos )

  if len(valueStr) == 0:
 return ''

  # remove the unicode hyphen
  valueStr = valueStr.replace( u'\u2212', '-' )

  # convert to a float
  value = float( valueStr )

  # now scale the value
  value *= self.scale

  # convert ot a Unicode string
  s = unicode( value )

  # add the unicode hyphen
  s.replace( '-', u'\u2212' )

  return s

   def set_locs( self, locs ):
  'Make sure the encompassed formatter get these set.'
  ticker.Formatter.set_locs( self, locs )
  self.formatter.set_locs( locs )

   def set_axis( self, axis ):
  'Make sure the encompassed formatter get these set.'
  ticker.Formatter.set_axis( self, axis )
  self.formatter.set_axis( axis )

   def set_view_interval( self, vmin, vmax ):
  'Make sure the encompassed formatter get these set.'
  ticker.Formatter.set_view_interval( self, vmin, vmax )
  self.formatter.set_view_interval( vmin, vmax )

   def set_data_interval( self, vmin, vmax ):
  'Make sure the encompassed formatter get these set.'
  ticker.Formatter.set_data_interval( self, vmin, vmax )
  self.formatter.set_data_interval( vmin, vmax )

   def set_bounds( self, vmin, vmax ):
  'Make sure the encompassed formatter get these set.'
  ticker.Formatter.set_bounds( self, vmin, vmax )
  self.formatter.set_bounds( vmin, vmax )


--James

> -Original Message-
> From: Thomas Caswell [mailto:[email protected]]
> Sent: Thursday, May 23, 2013 5:26 PM
> To: [email protected]
> Subject: [matplotlib-devel] adding second formatter/locater set to axes
> objects
> 
> A question I have seen go by twice on SO is how to add a tick marks to the
> top/right of a plot which are re-scaled version of the values on the
> bottom/lefit axis (ex km/h on the left and mph on the right).  My
> understanding of the best way to do this is to use twin* and then keep the
> range of the two axes in sync by hand.
> 
> I am proposing adding at set of alternate formatters/locators to the
`axis`
> objects which if they exist are used for the top/right labels.
> Before I dive too deep into this, I want to check that a) there isn't a
better
> way to do this that I do not know and b) if this sounds like a reasonable
> approach.
> 
> Tom
> 
> --
> Thomas Caswell
> [email protected]
> 
>

--
> Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only
SaaS-
> based application performance monitoring service that delivers powerful
full
> stack analytics. Optimize and monitor your browser, app, & servers with
just
> a few lines of code. Try New Relic and get this awesome Nerd Life shirt!
> http://p.sf.net/sfu/newrelic_d2d_may
> ___
> Matplotlib-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


--
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] Closing in on 1.3.0 release candidate

2013-05-24 Thread Michael Droettboom
The 1.3.0 release candidate tagging is scheduled for this coming Monday, 
May 27.  Unfortunately, due to an oversight on my part, I forgot that is 
a holiday, so I'm going to postpone it one day to Tuesday, May 28.  I 
will be hoping to tag the release by 23:00 UTC that day.

I think we're in really good shape for this release, given all of the 
great work solving and triaging bugs that's been going on since the 
feature freeze.

I think all of the blocker bugs (except possibly #2061) are really close 
to being resolved.  There are a number of issues tagged for 1.3.x that 
may unfortunately need to get punted, but not a very large number.

Question: Should I create a 1.3.x branch now?  The upside of doing that 
is that development of post-1.3.x things can continue on master until 
Tuesday, of course, and I think the pool of 1.3.x things is small enough 
for that to make sense.  The downside, of course, is that any existing 
pull requests against master will have to be manually merged to 1.3.x.  
That shouldn't be a big deal, though, because we don't have too many of 
them left and I can just pull the PR logs when I'm back at the office on 
Tuesday to find out which ones need to be merged.  Any objections to 
creating the branch now?

Mike

--
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Closing in on 1.3.0 release candidate

2013-05-24 Thread Michael Droettboom
I've gone ahead and created the 1.3.x branch on master.  This means that 
the feature freeze on master is effectively lifted.  Any PRs for 1.3.x 
should be milestoned as such before merging (and can be merged to either 
master or the 1.3.x branch).  That milestone will indicate to me what 
needs to be on the v1.3.x branch before making the release candidate 
early next week.

Mike

On 05/24/2013 01:38 PM, Michael Droettboom wrote:
> The 1.3.0 release candidate tagging is scheduled for this coming Monday,
> May 27.  Unfortunately, due to an oversight on my part, I forgot that is
> a holiday, so I'm going to postpone it one day to Tuesday, May 28.  I
> will be hoping to tag the release by 23:00 UTC that day.
>
> I think we're in really good shape for this release, given all of the
> great work solving and triaging bugs that's been going on since the
> feature freeze.
>
> I think all of the blocker bugs (except possibly #2061) are really close
> to being resolved.  There are a number of issues tagged for 1.3.x that
> may unfortunately need to get punted, but not a very large number.
>
> Question: Should I create a 1.3.x branch now?  The upside of doing that
> is that development of post-1.3.x things can continue on master until
> Tuesday, of course, and I think the pool of 1.3.x things is small enough
> for that to make sense.  The downside, of course, is that any existing
> pull requests against master will have to be manually merged to 1.3.x.
> That shouldn't be a big deal, though, because we don't have too many of
> them left and I can just pull the PR logs when I'm back at the office on
> Tuesday to find out which ones need to be merged.  Any objections to
> creating the branch now?
>
> Mike
>
> --
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> ___
> Matplotlib-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


--
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel