You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by jo...@apache.org on 2014/06/11 17:08:40 UTC
[1/2] git commit: CLIMATE-466 - Update plotter for better colorbar
Repository: climate
Updated Branches:
refs/heads/master b8c3503c7 -> 41d4d0751
CLIMATE-466 - Update plotter for better colorbar
- Update colorbar range to ensure that 0 is centered when there's a
0 value. Previously when the value range crossed 0 it was
possible to end up with a range where 0 was pushed very far to one
side. It's more convenient to analyze a graph when the 0 value is
centered in the color spectrum.
Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/c842a3b3
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/c842a3b3
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/c842a3b3
Branch: refs/heads/master
Commit: c842a3b31a7aafdbd6268e62d1d50663275148ef
Parents: b8c3503
Author: Maziyar Boustani <ma...@yahoo.com>
Authored: Fri Jun 6 15:18:45 2014 -0700
Committer: Michael Joyce <jo...@apache.org>
Committed: Wed Jun 11 07:58:45 2014 -0700
----------------------------------------------------------------------
ocw/plotter.py | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/climate/blob/c842a3b3/ocw/plotter.py
----------------------------------------------------------------------
diff --git a/ocw/plotter.py b/ocw/plotter.py
index 33a1bd1..07498df 100644
--- a/ocw/plotter.py
+++ b/ocw/plotter.py
@@ -61,8 +61,20 @@ def _nice_intervals(data, nlevs):
# Find the min and max levels by cutting off the tails of the distribution
# This mitigates the influence of outliers
data = data.ravel()
- mnlvl = mstats.scoreatpercentile(data, 5)
- mxlvl = mstats.scoreatpercentile(data, 95)
+ mn = mstats.scoreatpercentile(data, 5)
+ mx = mstats.scoreatpercentile(data, 95)
+ #if there min less than 0 and
+ # or max more than 0
+ #put 0 in center of color bar
+ if mn < 0 and mx > 0:
+ level = max(abs(mn), abs(mx))
+ mnlvl = -1 * level
+ mxlvl = level
+ #if min is larger than 0 then
+ #have color bar between min and max
+ else:
+ mnlvl = mn
+ mxlvl = mx
locator = mpl.ticker.MaxNLocator(nlevs)
clevs = locator.tick_values(mnlvl, mxlvl)
@@ -71,6 +83,7 @@ def _nice_intervals(data, nlevs):
clevs = clevs[(clevs >= mnlvl) & (clevs <= mxlvl)]
return clevs
+
def _best_grid_shape(nplots, oldshape):
'''
Purpose::
[2/2] git commit: Resolve CLIMATE-466. Merge PR #67.
Posted by jo...@apache.org.
Resolve CLIMATE-466. Merge PR #67.
Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/41d4d075
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/41d4d075
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/41d4d075
Branch: refs/heads/master
Commit: 41d4d0751b6a264a6a1c03e09a3c13d9f997d58c
Parents: b8c3503 c842a3b
Author: Michael Joyce <jo...@apache.org>
Authored: Wed Jun 11 08:08:10 2014 -0700
Committer: Michael Joyce <jo...@apache.org>
Committed: Wed Jun 11 08:08:10 2014 -0700
----------------------------------------------------------------------
ocw/plotter.py | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------