Skip to content

Add test to colorbar.py to see if ax is an object as returned by plt.subplots #8733

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 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
67d2324
Make histogram example figures fit on web page
dstansby May 12, 2017
719d556
Clarify how a FancyArrowPatch behaves
dstansby Jun 2, 2017
5d88cca
Fix typos
taehoonlee Jun 3, 2017
22488ff
Various cleanups to backends code.
anntzer Jun 3, 2017
df9e1d7
removing sgskip
choldgraf Jun 7, 2017
bb29bb6
Clarify in display units
dstansby Jun 7, 2017
f76a010
Parameterize test_fill_between and test_fill_betweenx
patniharshit Jun 7, 2017
a0ccb78
Add ids to test_fill_between tests
patniharshit Jun 7, 2017
2e6b968
colorbar.py: added test to see if parents are an object and to flatte…
jklymak Jun 8, 2017
7146ae6
Fixed PEP 8 error
jklymak Jun 8, 2017
1774e56
Merge pull request #8709 from taehoonlee/fix_typos
QuLogic Jun 8, 2017
34fda3e
Merge pull request #8729 from patniharshit/test_fill_between
QuLogic Jun 8, 2017
7fd3e25
Fixed so that we check to see if the object is an ndarray
jklymak Jun 8, 2017
80e9ec1
simplified logic to take into account all possible input cases
jklymak Jun 9, 2017
622307f
Merge pull request #8614 from dstansby/hist-example
tacaswell Jun 9, 2017
95cfdeb
Merge pull request #8725 from choldgraf/rem_sgskip
tacaswell Jun 9, 2017
1383228
Merge pull request #8703 from dstansby/fancyarrowpatch-clarify
anntzer Jun 9, 2017
4d26d74
Allow divmod to be overridden by numpy
dstansby Jun 9, 2017
60f547a
Merge pull request #8735 from dstansby/fix-tests
dstansby Jun 9, 2017
90ded74
Merge pull request #8711 from anntzer/backends-cleanup
QuLogic Jun 9, 2017
a5053c3
colorbar.py: added test to see if parents are an object and to flatte…
jklymak Jun 8, 2017
e178d2b
Fixed PEP 8 error
jklymak Jun 8, 2017
c4ea69a
Fixed so that we check to see if the object is an ndarray
jklymak Jun 8, 2017
0e31a22
simplified logic to take into account all possible input cases
jklymak Jun 9, 2017
3b2e06f
Rebased, hopefully get rid of CI error
jklymak Jun 9, 2017
b82411a
Rebased, hopefully get rid of CI error
jklymak Jun 9, 2017
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
2 changes: 1 addition & 1 deletion doc/users/github_stats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ Pull Requests (1003):
* :ghpull:`7548`: Clarify to_rgba docstring.
* :ghpull:`7476`: Sticky margins
* :ghpull:`7552`: Correctly extend a lognormed colorbar
* :ghpull:`7499`: Improve the the marker table in markers_api documentation
* :ghpull:`7499`: Improve the marker table in markers_api documentation
* :ghpull:`7468`: TST: Enable pytest-xdist
* :ghpull:`7530`: MAINT: TkAgg default backend depends on tkinter
* :ghpull:`7531`: double tolerance for test_png.py/pngsuite on Windows
Expand Down
4 changes: 2 additions & 2 deletions doc/users/prev_whats_new/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@ the `API changes <../../api/api_changes.html>`_.
(instead of deprecated popen*) and distutils (for version
checking) - DSD

2008-11-30 Reimplementaion of the legend which supports baseline alignement,
2008-11-30 Reimplementation of the legend which supports baseline alignement,
multi-column, and expand mode. - JJL

2008-12-01 Fixed histogram autoscaling bug when bins or range are given
Expand Down Expand Up @@ -5142,7 +5142,7 @@ the `API changes <../../api/api_changes.html>`_.

2004-05-19 0.54 released

2004-05-18 Added newline seperated text with rotations to text.Text
2004-05-18 Added newline separated text with rotations to text.Text
layout - JDH

2004-05-16 Added fast pcolor using PolyCollections. - JDH
Expand Down
2 changes: 1 addition & 1 deletion doc/users/whats_new/CheckButtons_widget_get_status.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CheckButtons widget get_status function
---------------------------------------

A :func:`get_status` function has been added the the :class:`matplotlib.widgets.CheckButtons` class. This :func:`get_status` function allows user to query the status (True/False) of all of the buttons in the CheckButtons object.
A :func:`get_status` function has been added the :class:`matplotlib.widgets.CheckButtons` class. This :func:`get_status` function allows user to query the status (True/False) of all of the buttons in the CheckButtons object.
2 changes: 1 addition & 1 deletion examples/api/colorbar_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# which axes object it should be near
fig.colorbar(pos, ax=ax1)

# repeat everything above for the the negative data
# repeat everything above for the negative data
neg = ax2.imshow(Zneg, cmap='Reds_r', interpolation='none')
fig.colorbar(neg, ax=ax2)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

"""

# -*- coding: utf-8 -*-

import matplotlib.pyplot as plt
from matplotlib.image import BboxImage
import numpy as np
Expand Down
4 changes: 2 additions & 2 deletions examples/statistics/hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
# edit the histogram to our liking. Let's change the color of each bar
# based on its y value.

fig, axs = plt.subplots(1, 2, figsize=(10, 5), tight_layout=True)
fig, axs = plt.subplots(1, 2, tight_layout=True)

# N is the count in each bin, bins is the lower-limit of the bin
N, bins, patches = axs[0].hist(x, bins=n_bins)
Expand Down Expand Up @@ -87,7 +87,7 @@
# Customizing a 2D histogram is similar to the 1D case, you can control
# visual components such as the bin size or color normalization.

fig, axs = plt.subplots(1, 3, figsize=(15, 5), sharex=True, sharey=True,
fig, axs = plt.subplots(3, 1, figsize=(5, 15), sharex=True, sharey=True,
tight_layout=True)

# We can increase the number of bins on each axis
Expand Down
2 changes: 1 addition & 1 deletion examples/text_labels_and_annotations/tex_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
you will see a lot of output from tex and associated tools. The next
time, the run may be silent, as a lot of the information is cached.

Notice how the the label for the y axis is provided using unicode!
Notice how the label for the y axis is provided using unicode!

"""
from __future__ import unicode_literals
Expand Down
2 changes: 1 addition & 1 deletion extern/libqhull/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3698,7 +3698,7 @@ coordT *qh_readpoints(int *numpoints, int *dimension, boolT *ismalloc) {
strncat(qh rbox_command, s, sizeof(qh rbox_command)-1);
}
if (!s) {
qh_fprintf(qh ferr, 6074, "qhull input error: missing \"begin\" for cdd-formated input\n");
qh_fprintf(qh ferr, 6074, "qhull input error: missing \"begin\" for cdd-formatted input\n");
qh_errexit(qh_ERRinput, NULL, NULL);
}
}
Expand Down
2 changes: 1 addition & 1 deletion extern/ttconv/pprdrv_tt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ void ttfont_trailer(TTStreamWriter& stream, struct TTFONT *font)

stream.put_char('\n');

/* This proceedure is for compatiblity with */
/* This proceedure is for compatibility with */
/* level 1 interpreters. */
stream.putline("/BuildChar {");
stream.putline(" 1 index /Encoding get exch get");
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ def to_html5_video(self):
<source type="video/mp4" src="data:video/mp4;base64,{video}">
Your browser does not support the video tag.
</video>'''
# Cache the the rendering of the video as HTML
# Cache the rendering of the video as HTML
if not hasattr(self, '_base64_video'):
# First write the video to a tempfile. Set delete to False
# so we can re-open to read binary data.
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ def get_agg_filter(self):

def set_agg_filter(self, filter_func):
"""
set agg_filter fuction.
set agg_filter function.

"""
self._agg_filter = filter_func
Expand Down
34 changes: 0 additions & 34 deletions lib/matplotlib/backends/backend_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,18 @@ class RendererAgg(RendererBase):

lock = threading.RLock()
def __init__(self, width, height, dpi):
if __debug__: verbose.report('RendererAgg.__init__', 'debug-annoying')
RendererBase.__init__(self)

self.dpi = dpi
self.width = width
self.height = height
if __debug__: verbose.report('RendererAgg.__init__ width=%s, height=%s'%(width, height), 'debug-annoying')
self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False)
self._filter_renderers = []

if __debug__: verbose.report('RendererAgg.__init__ _RendererAgg done',
'debug-annoying')

self._update_methods()
self.mathtext_parser = MathTextParser('Agg')

self.bbox = Bbox.from_bounds(0, 0, self.width, self.height)
if __debug__: verbose.report('RendererAgg.__init__ done',
'debug-annoying')

def __getstate__(self):
# We only want to preserve the init keywords of the Renderer.
Expand Down Expand Up @@ -178,8 +171,6 @@ def draw_mathtext(self, gc, x, y, s, prop, angle):
"""
Draw the math text using matplotlib.mathtext
"""
if __debug__: verbose.report('RendererAgg.draw_mathtext',
'debug-annoying')
ox, oy, width, height, descent, font_image, used_characters = \
self.mathtext_parser.parse(s, self.dpi, prop)

Expand All @@ -193,8 +184,6 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
"""
Render the text
"""
if __debug__: verbose.report('RendererAgg.draw_text', 'debug-annoying')

if ismath:
return self.draw_mathtext(gc, x, y, s, prop, angle)

Expand Down Expand Up @@ -279,9 +268,6 @@ def _get_agg_font(self, prop):
"""
Get the font for text instance t, cacheing for efficiency
"""
if __debug__: verbose.report('RendererAgg._get_agg_font',
'debug-annoying')

fname = findfont(prop)
font = get_font(
fname,
Expand All @@ -298,23 +284,15 @@ def points_to_pixels(self, points):
convert point measures to pixes using dpi and the pixels per
inch of the display
"""
if __debug__: verbose.report('RendererAgg.points_to_pixels',
'debug-annoying')
return points*self.dpi/72.0

def tostring_rgb(self):
if __debug__: verbose.report('RendererAgg.tostring_rgb',
'debug-annoying')
return self._renderer.tostring_rgb()

def tostring_argb(self):
if __debug__: verbose.report('RendererAgg.tostring_argb',
'debug-annoying')
return self._renderer.tostring_argb()

def buffer_rgba(self):
if __debug__: verbose.report('RendererAgg.buffer_rgba',
'debug-annoying')
return self._renderer.buffer_rgba()

def clear(self):
Expand Down Expand Up @@ -423,10 +401,6 @@ def new_figure_manager(num, *args, **kwargs):
"""
Create a new figure manager instance
"""
if __debug__: verbose.report('backend_agg.new_figure_manager',
'debug-annoying')


FigureClass = kwargs.pop('FigureClass', Figure)
thisFig = FigureClass(*args, **kwargs)
return new_figure_manager_given_figure(num, thisFig)
Expand Down Expand Up @@ -465,8 +439,6 @@ def draw(self):
"""
Draw the figure using the renderer
"""
if __debug__: verbose.report('FigureCanvasAgg.draw', 'debug-annoying')

self.renderer = self.get_renderer(cleared=True)
# acquire a lock on the shared font cache
RendererAgg.lock.acquire()
Expand Down Expand Up @@ -500,8 +472,6 @@ def tostring_rgb(self):
-------
bytes
'''
if __debug__: verbose.report('FigureCanvasAgg.tostring_rgb',
'debug-annoying')
return self.renderer.tostring_rgb()

def tostring_argb(self):
Expand All @@ -515,8 +485,6 @@ def tostring_argb(self):
bytes

'''
if __debug__: verbose.report('FigureCanvasAgg.tostring_argb',
'debug-annoying')
return self.renderer.tostring_argb()

def buffer_rgba(self):
Expand All @@ -529,8 +497,6 @@ def buffer_rgba(self):
-------
bytes
'''
if __debug__: verbose.report('FigureCanvasAgg.buffer_rgba',
'debug-annoying')
return self.renderer.buffer_rgba()

def print_raw(self, filename_or_obj, *args, **kwargs):
Expand Down
18 changes: 0 additions & 18 deletions lib/matplotlib/backends/backend_cairo.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

import numpy as np

def _fn_name(): return sys._getframe(1).f_code.co_name

try:
import cairocffi as cairo
except ImportError:
Expand Down Expand Up @@ -58,9 +56,6 @@ def _fn_name(): return sys._getframe(1).f_code.co_name
from matplotlib.transforms import Bbox, Affine2D
from matplotlib.font_manager import ttfFontProperty

_debug = False
#_debug = True

# Image::color_conv(format) for draw_image()
if sys.byteorder == 'little':
BYTE_FORMAT = 0 # BGRA
Expand Down Expand Up @@ -114,7 +109,6 @@ class RendererCairo(RendererBase):
def __init__(self, dpi):
"""
"""
if _debug: print('%s.%s()' % (self.__class__.__name__, _fn_name()))
self.dpi = dpi
self.gc = GraphicsContextCairo (renderer=self)
self.text_ctx = cairo.Context (
Expand Down Expand Up @@ -227,8 +221,6 @@ def draw_markers(self, gc, marker_path, marker_trans, path, transform, rgbFace=N

def draw_image(self, gc, x, y, im):
# bbox - not currently used
if _debug: print('%s.%s()' % (self.__class__.__name__, _fn_name()))

if sys.byteorder == 'little':
im = im[:, :, (2, 1, 0, 3)]
else:
Expand Down Expand Up @@ -266,8 +258,6 @@ def draw_image(self, gc, x, y, im):
def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
# Note: x,y are device/display coords, not user-coords, unlike other
# draw_* methods
if _debug: print('%s.%s()' % (self.__class__.__name__, _fn_name()))

if ismath:
self._draw_mathtext(gc, x, y, s, prop, angle)

Expand Down Expand Up @@ -297,8 +287,6 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
ctx.restore()

def _draw_mathtext(self, gc, x, y, s, prop, angle):
if _debug: print('%s.%s()' % (self.__class__.__name__, _fn_name()))

ctx = gc.ctx
width, height, descent, glyphs, rects = self.mathtext_parser.parse(
s, self.dpi, prop)
Expand Down Expand Up @@ -335,19 +323,16 @@ def _draw_mathtext(self, gc, x, y, s, prop, angle):


def flipy(self):
if _debug: print('%s.%s()' % (self.__class__.__name__, _fn_name()))
return True
#return False # tried - all draw objects ok except text (and images?)
# which comes out mirrored!


def get_canvas_width_height(self):
if _debug: print('%s.%s()' % (self.__class__.__name__, _fn_name()))
return self.width, self.height


def get_text_width_height_descent(self, s, prop, ismath):
if _debug: print('%s.%s()' % (self.__class__.__name__, _fn_name()))
if ismath:
width, height, descent, fonts, used_characters = self.mathtext_parser.parse(
s, self.dpi, prop)
Expand Down Expand Up @@ -376,15 +361,13 @@ def get_text_width_height_descent(self, s, prop, ismath):


def new_gc(self):
if _debug: print('%s.%s()' % (self.__class__.__name__, _fn_name()))
self.gc.ctx.save()
self.gc._alpha = 1.0
self.gc._forced_alpha = False # if True, _alpha overrides A from RGBA
return self.gc


def points_to_pixels(self, points):
if _debug: print('%s.%s()' % (self.__class__.__name__, _fn_name()))
return points/72.0 * self.dpi


Expand Down Expand Up @@ -488,7 +471,6 @@ def new_figure_manager(num, *args, **kwargs): # called by backends/__init__.py
"""
Create a new figure manager instance
"""
if _debug: print('%s()' % (_fn_name()))
FigureClass = kwargs.pop('FigureClass', Figure)
thisFig = FigureClass(*args, **kwargs)
return new_figure_manager_given_figure(num, thisFig)
Expand Down
6 changes: 2 additions & 4 deletions lib/matplotlib/backends/backend_gdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import os
import sys
import warnings
def fn_name(): return sys._getframe(1).f_code.co_name

import gobject
import gtk; gdk = gtk.gdk
Expand All @@ -24,16 +23,15 @@ def fn_name(): return sys._getframe(1).f_code.co_name
import matplotlib
from matplotlib import rcParams
from matplotlib._pylab_helpers import Gcf
from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
FigureManagerBase, FigureCanvasBase
from matplotlib.backend_bases import (
RendererBase, GraphicsContextBase, FigureManagerBase, FigureCanvasBase)
from matplotlib.cbook import restrict_dict, warn_deprecated
from matplotlib.figure import Figure
from matplotlib.mathtext import MathTextParser
from matplotlib.transforms import Affine2D
from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array

backend_version = "%d.%d.%d" % gtk.pygtk_version
_debug = False

# Image formats that this backend supports - for FileChooser and print_figure()
IMAGE_FORMAT = sorted(['bmp', 'eps', 'jpg', 'png', 'ps', 'svg']) # 'raw', 'rgb'
Expand Down
Loading