Skip to content

Make colorbar compatible accepting a list of axes created via gridspec #8755

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 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1b0ac37
Clarify how a FancyArrowPatch behaves
dstansby Jun 2, 2017
070a578
Clarify in display units
dstansby Jun 7, 2017
089818b
Allow divmod to be overridden by numpy
dstansby Jun 9, 2017
b87778e
Various cleanups to backends code.
anntzer Jun 3, 2017
40fa293
Update FreeType version in test_tightlayout4.
QuLogic Jun 2, 2017
c0ecc7d
Add a unique number to any renderer hash keys.
QuLogic Jun 3, 2017
df672df
Update tests that are marked flaky.
QuLogic Jun 3, 2017
9bf168f
Use itertools.count for renderer unique ID.
QuLogic Jun 4, 2017
454e9d6
Simplify cla sharex/sharey code; alternative to #8710
efiring Jun 4, 2017
edfdc53
MNT: colorbar accept numpy array input (#8739)
jklymak Jun 12, 2017
2284e98
Changed normalization in _spectral_helper() to obtain conistent scali…
DietBru May 6, 2017
234089d
Added note to api_changes
DietBru Jun 11, 2017
a62d3e3
Fix contour colour level determination
dstansby Jun 9, 2017
03c00d7
Correct contour level test
dstansby Jun 9, 2017
65f3906
sort input files
bmwiedemann Jun 12, 2017
62aa006
First pass; seems to work. More testing needed
jklymak Jun 13, 2017
fb3f419
First pass; seems to work. More testing needed
jklymak Jun 13, 2017
89857c7
First pass; seems to work. More testing needed
jklymak Jun 13, 2017
c68a411
First pass; seems to work. More testing needed
jklymak Jun 13, 2017
031d356
First change
jklymak Jun 13, 2017
1c5a14e
Aded comments and cleaned up
jklymak Jun 13, 2017
12737f5
Aded comments and cleaned up
jklymak Jun 13, 2017
600253e
Colormap that handles gridspec
jklymak Jun 13, 2017
fd388aa
Colormap that handles gridspec
jklymak Jun 13, 2017
262fa33
Colormap that handles gridspec
jklymak Jun 13, 2017
37998b4
Fixed subplotspec geometry having None
jklymak Jun 13, 2017
d9b49b5
Fixed subplotspec geometry having None, PEP8 errors
jklymak Jun 13, 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
Prev Previous commit
Next Next commit
Use itertools.count for renderer unique ID.
As suggested by @anntzer.
  • Loading branch information
QuLogic authored and jklymak committed Jun 13, 2017
commit 9bf168f792e6801b64c769258dc91dbff172dc54
25 changes: 8 additions & 17 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from contextlib import contextmanager
import importlib
import io
import itertools
import os
import sys
import time
Expand Down Expand Up @@ -101,8 +102,9 @@


# Used to ensure that caching based on renderer id() is unique without being as
# expensive as a real UUID.
_unique_renderer_id = 0
# expensive as a real UUID. 0 is used for renderers that don't derive from
# here, so start at 1.
_unique_renderer_id = itertools.count(1)


def register_backend(format, backend, description=None):
Expand Down Expand Up @@ -217,25 +219,14 @@ class RendererBase(object):

"""
def __init__(self):
self._id = None
# A lightweight id for unique-ification purposes. Along with id(self),
# the combination should be unique enough to use as part of a cache key.
self._uid = next(_unique_renderer_id)

self._texmanager = None

self._text2path = textpath.TextToPath()

@property
def _uid(self):
"""
A lightweight id for unique-ification purposes.

Along with id(self), this combination should be unique enough to use as
part of a caching key.
"""
if self._id is None:
global _unique_renderer_id
_unique_renderer_id += 1
self._id = _unique_renderer_id
return self._id

def open_group(self, s, gid=None):
"""
Open a grouping element with label *s*. If *gid* is given, use
Expand Down
17 changes: 4 additions & 13 deletions lib/matplotlib/backends/backend_mixed.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import six

import matplotlib.backend_bases
from matplotlib.backends.backend_agg import RendererAgg
from matplotlib.tight_bbox import process_figure_for_rasterizing

Expand Down Expand Up @@ -49,7 +50,9 @@ def __init__(self, figure, width, height, dpi, vector_renderer,
if raster_renderer_class is None:
raster_renderer_class = RendererAgg

self._id = None
# See matplotlib.backend_bases.RendererBase._uid.
self._uid = next(matplotlib.backend_bases._unique_renderer_id)

self._raster_renderer_class = raster_renderer_class
self._width = width
self._height = height
Expand Down Expand Up @@ -81,18 +84,6 @@ def __init__(self, figure, width, height, dpi, vector_renderer,
_text2path _get_text_path_transform height width
""".split()

@property
def _uid(self):
"""
See matplotlib.backend_bases.RendererBase._uid.
"""
if self._id is None:
from matplotlib import backend_bases
backend_bases._unique_renderer_id
backend_bases._unique_renderer_id += 1
self._id = backend_bases._unique_renderer_id
return self._id

def _set_current_renderer(self, renderer):
self._renderer = renderer

Expand Down