Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Dflt autodateformat#5698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mdboom merged 4 commits intomatplotlib:v2.xfromtacaswell:dflt_autodateformat
Jan 4, 2016
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletionsdoc/users/whats_new/rcparams.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
Added ``svg.hashsalt`` key to rcParams
```````````````````````````````````````
Configuration (rcParams)
------------------------

+----------------------------+--------------------------------------------------+
| Parameter | Description |
+============================+==================================================+
|`date.autoformatter.year` | foramt string for 'year' scale dates |
+----------------------------+--------------------------------------------------+
|`date.autoformatter.month` | format string for 'month' scale dates |
+----------------------------+--------------------------------------------------+
|`date.autoformatter.day` | format string for 'day' scale dates |
+----------------------------+--------------------------------------------------+
|`date.autoformatter.hour` | format string for 'hour' scale times |
+----------------------------+--------------------------------------------------+
|`date.autoformatter.minute` | format string for 'minute' scale times |
+----------------------------+--------------------------------------------------+
|`date.autoformatter.second` | format string for 'second' scale times |
+----------------------------+--------------------------------------------------+
|`svg.hashsalt` | see note |
+----------------------------+--------------------------------------------------+

``svg.hashsalt``
````````````````

If ``svg.hashsalt`` is ``None`` (which it is by default), the svg backend uses ``uuid4`` to generate the hash salt.
If it is not ``None``, it must be a string that is used as the hash salt instead of ``uuid4``.
This allows for deterministic SVG output.
29 changes: 16 additions & 13 deletionslib/matplotlib/dates.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -113,8 +113,8 @@
unicode_literals)

from matplotlib.externals import six
from matplotlib.externals.six.moves importxrange,zip

from matplotlib.externals.six.moves import zip
from matplotlib import rcParams
import re
import time
import math
Expand DownExpand Up@@ -629,12 +629,12 @@ class AutoDateFormatter(ticker.Formatter):
format string. The default looks like this::

self.scaled = {
365.0 : '%Y',
30. : '%b %Y',
1.0 : '%b %d %Y',
1./24. : '%H:%M:%S',
1. / (24. * 60.):'%H:%M:%S.%f',
}
DAYS_PER_YEAR: rcParams['date.autoformat.year'],
DAYS_PER_MONTH: rcParams['date.autoformat.month'],
1.0: rcParams['date.autoformat.day'],
1. / HOURS_PER_DAY: rcParams['date.autoformat.hour'],
1. / (MINUTES_PER_DAY):rcParams['date.autoformat.minute'],
1. / (SEC_PER_DAY): rcParams['date.autoformat.second']}


The algorithm picks the key in the dictionary that is >= the
Expand DownExpand Up@@ -685,11 +685,14 @@ def __init__(self, locator, tz=None, defaultfmt='%Y-%m-%d'):
self._tz = tz
self.defaultfmt = defaultfmt
self._formatter = DateFormatter(self.defaultfmt, tz)
self.scaled = {DAYS_PER_YEAR: '%Y',
DAYS_PER_MONTH: '%b %Y',
1.0: '%b %d %Y',
1. / HOURS_PER_DAY: '%H:%M:%S',
1. / (MINUTES_PER_DAY): '%H:%M:%S.%f'}
self.scaled = {DAYS_PER_YEAR: rcParams['date.autoformatter.year'],
DAYS_PER_MONTH: rcParams['date.autoformatter.month'],
1.0: rcParams['date.autoformatter.day'],
1. / HOURS_PER_DAY: rcParams['date.autoformatter.hour'],
1. / (MINUTES_PER_DAY):
rcParams['date.autoformatter.minute'],
1. / (SEC_PER_DAY):
rcParams['date.autoformatter.second']}

def __call__(self, x, pos=None):
locator_unit_scale = float(self._locator._get_unit())
Expand Down
7 changes: 7 additions & 0 deletionslib/matplotlib/mpl-data/stylelib/classic.mplstyle
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -215,6 +215,13 @@ axes.spines.top : True
polaraxes.grid : True # display grid on polar axes
axes3d.grid : True # display grid on 3d axes

date.autoformatter.year : %Y
date.autoformatter.month : %b %Y
date.autoformatter.day : %b %d %Y
date.autoformatter.hour : %H:%M:%S
date.autoformatter.minute : %H:%M:%S.%f
date.autoformatter.second : %H:%M:%S.%f

### TICKS
# see http://matplotlib.org/api/axis_api.html#matplotlib.axis.Tick

Expand Down
7 changes: 7 additions & 0 deletionslib/matplotlib/rcsetup.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1015,6 +1015,13 @@ def validate_hist_bins(s):
'polaraxes.grid': [True, validate_bool], # display polar grid or
# not
'axes3d.grid': [True, validate_bool], # display 3d grid
# TODO validate that these are valid datetime format strings
'date.autoformatter.year': ['%Y', six.text_type],
'date.autoformatter.month': ['%Y-%m', six.text_type],
'date.autoformatter.day': ['%Y-%m-%d', six.text_type],
'date.autoformatter.hour': ['%H:%M', six.text_type],
'date.autoformatter.minute': ['%H:%M:%S', six.text_type],
'date.autoformatter.second': ['%H:%M:%S.%f', six.text_type],

#legend properties
'legend.fancybox': [False, validate_bool],
Expand Down
19 changes: 18 additions & 1 deletionmatplotlibrc.template
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,7 +35,7 @@
# You can also deploy your own backend outside of matplotlib by
# referring to the module name (which must be in the PYTHONPATH) as
# 'module://my_backend'.
backend :%(backend)s
backend :$TEMPLATE_BACKEND

# If you are using the Qt4Agg backend, you can choose here
# to use the PyQt4 bindings or the newer PySide bindings to
Expand DownExpand Up@@ -311,6 +311,7 @@ backend : %(backend)s
# small compared to the minimum absolute
# value of the data.


#axes.unicode_minus : True # use unicode for the minus symbol
# rather than hyphen. See
# http://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes
Expand All@@ -328,6 +329,22 @@ backend : %(backend)s
#polaraxes.grid : True # display grid on polar axes
#axes3d.grid : True # display grid on 3d axes

### DATES
# These control the default format strings used in AutoDateFormatter.
# Any valid format datetime format string can be used (see the python
# `datetime` for details). For example using '%%x' will use the locale date representation
# '%%X' will use the locale time representation and '%%c' will use the full locale datetime
# representation.
# These values map to the scales:
# {'year': 365, 'month': 30, 'day': 1, 'hour': 1/24, 'minute': 1 / (24 * 60)}

# date.autoformatter.year : %Y
# date.autoformatter.month : %Y-%m
# date.autoformatter.day : %Y-%m-%d
# date.autoformatter.hour : %H:%M
# date.autoformatter.minute : %H:%M:%S
# date.autoformatter.second : %H:%M:%S.%f

### TICKS
# see http://matplotlib.org/api/axis_api.html#matplotlib.axis.Tick

Expand Down
5 changes: 3 additions & 2 deletionssetup.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@
"""

from __future__ import print_function, absolute_import

from string import Template
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Weird that I've never used this, but it seems like the right tool for the job...

# This needs to be the very first thing to use distribute
from distribute_setup import use_setuptools
use_setuptools()
Expand DownExpand Up@@ -230,8 +230,9 @@ def run(self):
default_backend = setupext.options['backend']
with open('matplotlibrc.template') as fd:
template = fd.read()
template = Template(template)
with open('lib/matplotlib/mpl-data/matplotlibrc', 'w') as fd:
fd.write(template % {'backend':default_backend})
fd.write(template.safe_substitute(TEMPLATE_BACKEND=default_backend))

# Build in verbose mode if requested
if setupext.options['verbose']:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp