Skip to content

Commit

Permalink
Conflicts resolved with rel-v7r2
Browse files Browse the repository at this point in the history
  • Loading branch information
atsareg committed Apr 29, 2021
2 parents 54c5d41 + c1ed265 commit 0e28c08
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
5 changes: 5 additions & 0 deletions release.notes
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ NEW: (#5042) Multi-VO mode of operation support
*tests
CHANGE: (#5046) don't use mail in the self generated certificates

[v7r2p6]

*Core
FIX: (#5000) Display thousands separators in PrettyScalarFormatter again

[v7r2p5]

FIX: fixes from v7r0p56, v7r1p39
Expand Down
31 changes: 12 additions & 19 deletions src/DIRAC/Core/Utilities/Graphs/GraphUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@
import pytz
import numpy

from matplotlib.pyplot import rcParams
from matplotlib.ticker import ScalarFormatter
from matplotlib.dates import AutoDateLocator, AutoDateFormatter, DateFormatter, RRuleLocator, \
rrulewrapper, HOURLY, MINUTELY, SECONDLY, YEARLY, MONTHLY, DAILY
from dateutil.relativedelta import relativedelta

# This is a hack to workaround the use of float(ScalarFormatter.__call__(...))
rcParams["axes.unicode_minus"] = False


def evalPrefs(*args, **kw):
""" Interpret arguments as preferencies dictionaries or key-value pairs. The overriding order
Expand Down Expand Up @@ -209,28 +213,17 @@ def comma_format(x_orig):


class PrettyScalarFormatter(ScalarFormatter):
def __init__(self, *args, **kwargs):
super(PrettyScalarFormatter, self).__init__(*args, **kwargs)
self.set_powerlimits([-7, 9])
self._useLocale = True

def _set_orderOfMagnitude(self, range):
# if scientific notation is to be used, find the appropriate exponent
# if using an numerical offset, find the exponent after applying the offset
locs = numpy.absolute(self.locs)
def __call__(self, x, pos=None):
val = super(PrettyScalarFormatter, self).__call__(x, pos=pos)
if self.offset:
oom = math.floor(math.log10(range))
else:
if locs[0] > locs[-1]:
val = locs[0]
else:
val = locs[-1]
if val == 0:
oom = 0
else:
oom = math.floor(math.log10(val))
if oom <= -7:
self.orderOfMagnitude = oom
elif oom >= 9:
self.orderOfMagnitude = oom
return val
else:
self.orderOfMagnitude = 0
return comma_format(val)


class PrettyDateFormatter(AutoDateFormatter):
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0e28c08

Please sign in to comment.