Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix issue 7712 #1

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
eb07c30
Minor cleanup: PEP8, PEP257
timhoffm Feb 20, 2018
47729ee
Stop checking wx version.
anntzer Mar 1, 2018
48a1798
Added markevery validator to rcparams with basic rcparams test
salindersidhu Mar 7, 2018
e21dd0f
Added markevery validator to rcparams with basic rcparams test
salindersidhu Mar 7, 2018
48c57d6
Merge branch 'fixed-issue-8576' of ssh://github.com/salindersidhu/mat…
salindersidhu Mar 7, 2018
8afad91
Finished markevery validator and test cases. Added what's new and exa…
salindersidhu Mar 8, 2018
3bee936
Added markevery validator to rcparams with basic rcparams test
salindersidhu Mar 7, 2018
b73fe0f
Finished markevery validator and test cases. Added what's new and exa…
salindersidhu Mar 8, 2018
5eb2665
Merge branch 'fixed-issue-8576' of github.com:salindersidhu/matplotli…
salindersidhu Mar 8, 2018
3cae753
sys.platform is normalized to "linux" on Py3.
anntzer Mar 8, 2018
c4d4f11
Increased test coverage of markevery validator
salindersidhu Mar 8, 2018
9a2def6
Fixed typo
salindersidhu Mar 8, 2018
3a71055
Fixed validate_markevery
salindersidhu Mar 8, 2018
3154b90
Resolved build errors
salindersidhu Mar 8, 2018
b51c650
Doc typo
Mar 9, 2018
af1cab6
Doc Mistitle
Mar 9, 2018
7111817
Avoid narrowing conversion in image_wrapper on 32-bit.
anntzer Mar 9, 2018
8e87ec4
FIX: reorder linewidth setting before linestyle
jklymak Mar 9, 2018
f31d35d
FIX: ffmpeg logging level
jklymak Mar 9, 2018
a65b9c1
DOC: add comment about buffer overrun at DEBUG
jklymak Mar 9, 2018
583d005
Merge pull request #10731 from roonjoot/doc
jklymak Mar 9, 2018
5b7a21e
Merge pull request #10736 from anntzer/narrowing
jklymak Mar 9, 2018
d7ac70a
Merge pull request #10636 from anntzer/wxversion
jklymak Mar 9, 2018
aadd0e0
Merge pull request #10542 from timhoffm/minor-cleanup-pep8-pep257
jklymak Mar 9, 2018
2e8184b
overlap tick dates
shadidsh Mar 9, 2018
a408aff
PEP8: omg trailing white space
jklymak Mar 9, 2018
a79ff86
make centre_baseline legal for Text.set_verticalalignment
swfiua Mar 11, 2018
eecdc3c
FIX: re-instate verbose alias
jklymak Mar 8, 2018
d420e66
Merge pull request #10714 from anntzer/py3sysplat
timhoffm Mar 11, 2018
81bd65d
fix Text.__init__() to use set_*alignment methods
swfiua Mar 11, 2018
2ad362a
Merge pull request #10742 from jklymak/fix-reorder-linewitdth-setting
timhoffm Mar 11, 2018
4165add
Update copyright date to 2018
timhoffm Mar 11, 2018
d7329df
US/UK english typo confusion
swfiua Mar 11, 2018
575e013
Merge pull request #10752 from timhoffm/update-copyright-date
jklymak Mar 11, 2018
8605b35
Fix image fmt detection for Path input.
anntzer Mar 12, 2018
36dd933
avoid floating numbers as intervals
shadidsh Mar 12, 2018
e99bee8
Merge pull request #10726 from jklymak/FIX-re-instate-verbose-alias
tacaswell Mar 12, 2018
8bc52ad
Merge pull request #10739 from jklymak/fix-ffmpeg-log-level
dopplershift Mar 12, 2018
24d530e
Merge pull request #10754 from anntzer/pathlib-default-fmt
jklymak Mar 12, 2018
5c09b01
FIX/TST OS X builds
jklymak Mar 13, 2018
5034698
FIX/TST OS X builds
jklymak Mar 13, 2018
ccd6377
Merge pull request #10771 from jklymak/fix-tst-mactravis
anntzer Mar 13, 2018
8af1fac
Merge pull request #10751 from swfiua/cb
dopplershift Mar 13, 2018
769cfb8
API: check locator and formatter args when passed
jklymak Mar 13, 2018
a6651fe
FIX: back to isinstance
jklymak Mar 14, 2018
b2782e0
Merge pull request #10713 from salindersidhu/fixed-issue-8576
efiring Mar 14, 2018
8a27054
Merge pull request #10772 from jklymak/api-check-locatorargs
timhoffm Mar 14, 2018
19bb1f0
finished changes in AutoDateLocator, added and modified several image…
shadidsh Mar 14, 2018
4159670
Merge branch 'master' of git://github.com/matplotlib/matplotlib into …
shadidsh Mar 14, 2018
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ before_install:
# We could install ghostscript and inkscape here to test svg and pdf
# but this makes the test time really long.
# brew install ghostscript inkscape
export PATH=/usr/local/opt/ccache/libexec:$PATH
export PATH=/usr/local/opt/python/libexec/bin:/usr/local/opt/ccache/libexec:$PATH
fi

install:
Expand Down Expand Up @@ -153,7 +153,7 @@ install:
python -c 'import PyQt5.QtCore' &&
echo 'PyQt5 is available' ||
echo 'PyQt5 is not available'
python -mpip install -U --pre \
python -mpip install -U \
--no-index -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04 \
wxPython &&
python -c 'import wx' &&
Expand Down
5 changes: 5 additions & 0 deletions doc/api/next_api_changes/2018-03-14-SS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
``AutoDateLocator.get_locator`` now contains reduced datetime overlaps
````````````````````````````````````````````````````````````````````````

Due to issue #7712, the interval frequency of datetime ticks gets reduced in order
to avoid overlapping tick labels.
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def _check_deps():
project = 'Matplotlib'
copyright = ('2002 - 2012 John Hunter, Darren Dale, Eric Firing, '
'Michael Droettboom and the Matplotlib development '
'team; 2012 - 2017 The Matplotlib development team')
'team; 2012 - 2018 The Matplotlib development team')

# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
Expand Down
17 changes: 7 additions & 10 deletions doc/sphinxext/mock_gui_toolkits.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,12 @@ class ToolBar(object):
class Frame(object):
pass

VERSION_STRING = '2.9'


def setup(app):
sys.modules['cairocffi'] = MyCairoCffi()
sys.modules['PyQt4'] = MyPyQt4()
sys.modules['sip'] = MySip()
sys.modules['wx'] = MyWX()
sys.modules['wxversion'] = MagicMock()

metadata = {'parallel_read_safe': True, 'parallel_write_safe': True}
return metadata
sys.modules.update(
cairocffi=MyCairoCffi(),
PyQt4=MyPyQt4(),
sip=MySip(),
wx=MyWX(),
)
return {'parallel_read_safe': True, 'parallel_write_safe': True}
7 changes: 7 additions & 0 deletions doc/users/next_whats_new/markevery_prop_cycle.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Implemented support for axes.prop_cycle property markevery in rcParams
----------------------------------------------------------------------

The Matplotlib ``rcParams`` settings object now supports configuration
of the attribute `axes.prop_cycle` with cyclers using the `markevery`
Line2D object property. An example of this feature is provided at
`~matplotlib/examples/lines_bars_and_markers/markevery_prop_cycle.py`
67 changes: 67 additions & 0 deletions examples/lines_bars_and_markers/markevery_prop_cycle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
"""
=================================================================
Implemented support for prop_cycle property markevery in rcParams
=================================================================

This example demonstrates a working solution to issue #8576, providing full
support of the markevery property for axes.prop_cycle assignments through
rcParams. Makes use of the same list of markevery cases from
https://matplotlib.org/examples/pylab_examples/markevery_demo.html

Renders a plot with shifted-sine curves along each column with
a unique markevery value for each sine curve.
"""
from cycler import cycler
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

# Define a list of markevery cases and color cases to plot
cases = [None,
8,
(30, 8),
[16, 24, 30],
[0, -1],
slice(100, 200, 3),
0.1,
0.3,
1.5,
(0.0, 0.1),
(0.45, 0.1)]

colors = ['#1f77b4',
'#ff7f0e',
'#2ca02c',
'#d62728',
'#9467bd',
'#8c564b',
'#e377c2',
'#7f7f7f',
'#bcbd22',
'#17becf',
'#1a55FF']

# Create two different cyclers to use with axes.prop_cycle
markevery_cycler = cycler(markevery=cases)
color_cycler = cycler('color', colors)

# Configure rcParams axes.prop_cycle with custom cycler
custom_cycler = color_cycler + markevery_cycler
mpl.rcParams['axes.prop_cycle'] = custom_cycler

# Create data points and offsets
x = np.linspace(0, 2 * np.pi)
offsets = np.linspace(0, 2 * np.pi, 11, endpoint=False)
yy = np.transpose([np.sin(x + phi) for phi in offsets])

# Set the plot curve with markers and a title
fig = plt.figure()
ax = fig.add_axes([0.1, 0.1, 0.6, 0.75])

for i in range(len(cases)):
ax.plot(yy[:, i], marker='o', label=str(cases[i]))
ax.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)

plt.title('Support for axes.prop_cycle cycler with markevery')

plt.show()
8 changes: 7 additions & 1 deletion lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ def _is_writable_dir(p):
return os.access(p, os.W_OK) and os.path.isdir(p)

_verbose_msg = """\
matplotlib.verbose is deprecated;
Command line argument --verbose-LEVEL is deprecated.
This functionality is now provided by the standard
python logging library. To get more (or less) logging output:
Expand Down Expand Up @@ -297,7 +298,6 @@ def _parse_commandline():
_parse_commandline()


@cbook.deprecated("2.2", message=_verbose_msg)
class Verbose(object):
"""
A class to handle reporting. Set the fileo attribute to any file
Expand All @@ -320,10 +320,12 @@ class Verbose(object):
if level_str in levels:
_commandLineVerbose = level_str

@cbook.deprecated("2.2", message=_verbose_msg)
def __init__(self):
self.set_level('silent')
self.fileo = sys.stdout

@cbook.deprecated("2.2", message=_verbose_msg)
def set_level(self, level):
'set the verbosity to one of the Verbose.levels strings'

Expand All @@ -335,6 +337,7 @@ def set_level(self, level):
else:
self.level = level

@cbook.deprecated("2.2", message=_verbose_msg)
def set_fileo(self, fname):
std = {
'sys.stdout': sys.stdout,
Expand All @@ -352,6 +355,7 @@ def set_fileo(self, fname):
else:
self.fileo = fileo

@cbook.deprecated("2.2", message=_verbose_msg)
def report(self, s, level='helpful'):
"""
print message s to self.fileo if self.level>=level. Return
Expand All @@ -363,6 +367,7 @@ def report(self, s, level='helpful'):
return True
return False

@cbook.deprecated("2.2", message=_verbose_msg)
def wrap(self, fmt, func, level='helpful', always=True):
"""
return a callable function that wraps func and reports it
Expand All @@ -386,6 +391,7 @@ def wrapper(*args, **kwargs):
wrapper.__doc__ = func.__doc__
return wrapper

@cbook.deprecated("2.2", message=_verbose_msg)
def ge(self, level):
'return true if self.level is >= level'
return self.vald[self.level] >= self.vald[level]
Expand Down
5 changes: 3 additions & 2 deletions lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,9 @@ def _args(self):
'-s', '%dx%d' % self.frame_size, '-pix_fmt', self.frame_format,
'-r', str(self.fps)]
# Logging is quieted because subprocess.PIPE has limited buffer size.

if (_log.getEffectiveLevel() < logging.DEBUG):
# If you have a lot of frames in your animation and set logging to
# DEBUG, you will have a buffer overrun.
if (_log.getEffectiveLevel() > logging.DEBUG):
args += ['-loglevel', 'quiet']
args += ['-i', 'pipe:'] + self.output_args
return args
Expand Down
12 changes: 12 additions & 0 deletions lib/matplotlib/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1568,6 +1568,9 @@ def set_major_formatter(self, formatter):

ACCEPTS: A :class:`~matplotlib.ticker.Formatter` instance
"""
if not isinstance(formatter, mticker.Formatter):
raise TypeError("formatter argument should be instance of "
"matplotlib.ticker.Formatter")
self.isDefault_majfmt = False
self.major.formatter = formatter
formatter.set_axis(self)
Expand All @@ -1579,6 +1582,9 @@ def set_minor_formatter(self, formatter):

ACCEPTS: A :class:`~matplotlib.ticker.Formatter` instance
"""
if not isinstance(formatter, mticker.Formatter):
raise TypeError("formatter argument should be instance of "
"matplotlib.ticker.Formatter")
self.isDefault_minfmt = False
self.minor.formatter = formatter
formatter.set_axis(self)
Expand All @@ -1590,6 +1596,9 @@ def set_major_locator(self, locator):

ACCEPTS: a :class:`~matplotlib.ticker.Locator` instance
"""
if not isinstance(locator, mticker.Locator):
raise TypeError("formatter argument should be instance of "
"matplotlib.ticker.Locator")
self.isDefault_majloc = False
self.major.locator = locator
locator.set_axis(self)
Expand All @@ -1601,6 +1610,9 @@ def set_minor_locator(self, locator):

ACCEPTS: a :class:`~matplotlib.ticker.Locator` instance
"""
if not isinstance(locator, mticker.Locator):
raise TypeError("formatter argument should be instance of "
"matplotlib.ticker.Locator")
self.isDefault_minloc = False
self.minor.locator = locator
locator.set_axis(self)
Expand Down
2 changes: 2 additions & 0 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,8 @@ def print_figure(self, filename, dpi=None, facecolor=None, edgecolor=None,

if format is None:
# get format from filename, or from backend's default filetype
if isinstance(filename, getattr(os, "PathLike", ())):
filename = os.fspath(filename)
if isinstance(filename, six.string_types):
format = os.path.splitext(filename)[1][1:]
if format is None or format == '':
Expand Down
22 changes: 10 additions & 12 deletions lib/matplotlib/backends/_backend_tk.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,10 @@ def button_press_event(self, event, dblclick=False):
y = self.figure.bbox.height - event.y
num = getattr(event, 'num', None)

if sys.platform=='darwin':
# 2 and 3 were reversed on the OSX platform I
# tested under tkagg
if num==2: num=3
elif num==3: num=2
if sys.platform == 'darwin':
# 2 and 3 were reversed on the OSX platform I tested under tkagg.
if num == 2: num = 3
elif num == 3: num = 2

FigureCanvasBase.button_press_event(self, x, y, num, dblclick=dblclick, guiEvent=event)

Expand All @@ -354,11 +353,10 @@ def button_release_event(self, event):

num = getattr(event, 'num', None)

if sys.platform=='darwin':
# 2 and 3 were reversed on the OSX platform I
# tested under tkagg
if num==2: num=3
elif num==3: num=2
if sys.platform == 'darwin':
# 2 and 3 were reversed on the OSX platform I tested under tkagg.
if num == 2: num = 3
elif num == 3: num = 2

FigureCanvasBase.button_release_event(self, x, y, num, guiEvent=event)

Expand Down Expand Up @@ -387,8 +385,8 @@ def _get_key(self, event):
val = event.keysym_num
if val in self.keyvald:
key = self.keyvald[val]
elif val == 0 and sys.platform == 'darwin' and \
event.keycode in self._keycode_lookup:
elif (val == 0 and sys.platform == 'darwin'
and event.keycode in self._keycode_lookup):
key = self._keycode_lookup[event.keycode]
elif val < 256:
key = chr(val)
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

# create a list of system fonts, all of these should work with xe/lua-latex
system_fonts = []
if sys.platform.startswith('win'):
if sys.platform == 'win32':
from matplotlib import font_manager
for f in font_manager.win32InstalledFonts():
try:
Expand Down
44 changes: 9 additions & 35 deletions lib/matplotlib/backends/wx_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,12 @@
unicode_literals)

import six
from distutils.version import StrictVersion, LooseVersion

missingwx = "Matplotlib backend_wx and backend_wxagg require wxPython>=2.9"
import wx
backend_version = wx.VERSION_STRING
is_phoenix = 'phoenix' in wx.PlatformInfo


try:
import wx
backend_version = wx.VERSION_STRING
is_phoenix = 'phoenix' in wx.PlatformInfo
except ImportError:
raise ImportError(missingwx)

try:
wx_version = StrictVersion(wx.VERSION_STRING)
except ValueError:
wx_version = LooseVersion(wx.VERSION_STRING)

# Ensure we have the correct version imported
if wx_version < str("2.9"):
raise ImportError(missingwx)

if is_phoenix:
# define all the wxPython phoenix stuff

Expand Down Expand Up @@ -157,22 +142,11 @@ def _AddTool(parent, wx_ids, text, bmp, tooltip_text):
else:
add_tool = parent.DoAddTool

if not is_phoenix or wx_version >= str("4.0.0b2"):
# NOTE: when support for Phoenix prior to 4.0.0b2 is dropped then
# all that is needed is this clause, and the if and else clause can
# be removed.
kwargs = dict(label=text,
bitmap=bmp,
bmpDisabled=wx.NullBitmap,
shortHelp=text,
longHelp=tooltip_text,
kind=kind)
else:
kwargs = dict(label=text,
bitmap=bmp,
bmpDisabled=wx.NullBitmap,
shortHelpString=text,
longHelpString=tooltip_text,
kind=kind)
kwargs = dict(label=text,
bitmap=bmp,
bmpDisabled=wx.NullBitmap,
shortHelp=text,
longHelp=tooltip_text,
kind=kind)

return add_tool(wx_ids[text], **kwargs)
Loading