Skip to content

Commit 87ba9cb

Browse files
committed
Updated CHANGELOG to put proposed change at the top of the list
Reverted from the 'combine_images' terminology back to the 'composite_image' terminology. With this terminology, we can keep the method name 'renderer.option_image_nocomposite()', and maintain backwards compatibility.
1 parent b92ba6b commit 87ba9cb

22 files changed

+63
-65
lines changed

CHANGELOG

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1+
2015-02-27 Added the rcParam 'image.composite_image' to permit users
2+
to decide whether they want the vector graphics backends to combine
3+
all images within a set of axes into a single composite image.
4+
(If images do not get combined, users can open vector graphics files
5+
in Adobe Illustrator or Inkscape and edit each image individually.)
6+
17
2015-02-19 Rewrite of C++ code that calculates contours to add support for
28
corner masking. This is controlled by the 'corner_mask' keyword
39
in plotting commands 'contour' and 'contourf'. - IMT
410

5-
2015-01-31 Added the rcParam 'image.combine_images' to permit users
6-
to decide whether they want the vector graphics backends to combine
7-
all images within a set of axes into a single image. (If images do
8-
not get combined, users can open vector graphics files in Adobe
9-
Illustrator or Inkscape and edit each image individually.) Also
10-
changed 'renderer.option_nocomposite' to the clearer name
11-
'renderer.option_combine_images'.
12-
1311
2015-01-23 Text bounding boxes are now computed with advance width rather than
1412
ink area. This may result in slightly different placement of text.
1513

lib/matplotlib/axes/_base.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -2028,13 +2028,13 @@ def draw(self, renderer=None, inframe=False):
20282028
dsu = [(a.zorder, a) for a in artists
20292029
if not a.get_animated()]
20302030

2031-
# add images to dsu if the backend supports combining images.
2032-
# otherwise, perform manual combining, without adding images to dsu.
2033-
if len(self.images) <= 1 or not renderer.option_combine_images():
2031+
# add images to dsu if the backend supports compositing.
2032+
# otherwise, does the manual compositing without adding images to dsu.
2033+
if len(self.images) <= 1 or renderer.option_image_nocomposite():
20342034
dsu.extend([(im.zorder, im) for im in self.images])
2035-
_combine_images = False
2035+
_do_composite = False
20362036
else:
2037-
_combine_images = True
2037+
_do_composite = True
20382038

20392039
dsu.sort(key=itemgetter(0))
20402040

@@ -2054,8 +2054,8 @@ def draw(self, renderer=None, inframe=False):
20542054
if self.axison and self._frameon:
20552055
self.patch.draw(renderer)
20562056

2057-
if _combine_images:
2058-
# combine images, blending alpha
2057+
if _do_composite:
2058+
# make a composite image, blending alpha
20592059
# list of (mimage.Image, ox, oy)
20602060

20612061
zorder_images = [(im.zorder, im) for im in self.images

lib/matplotlib/backend_bases.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -527,12 +527,12 @@ def draw_image(self, gc, x, y, im):
527527
"""
528528
raise NotImplementedError
529529

530-
def option_combine_images(self):
530+
def option_image_nocomposite(self):
531531
"""
532-
override this method for renderers that do not necessarily
532+
override this method for renderers that do not necessarily always
533533
want to rescale and composite raster images. (like SVG, PDF, or PS)
534534
"""
535-
return True
535+
return False
536536

537537
def option_scale_image(self):
538538
"""

lib/matplotlib/backends/backend_agg.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,11 @@ def buffer_rgba(self):
322322
def clear(self):
323323
self._renderer.clear()
324324

325-
def option_combine_images(self):
326-
# It is generally faster to write each image directly to
327-
# the Figure, and there's no file size benefit to combining images
325+
def option_image_nocomposite(self):
326+
# It is generally faster to composite each image directly to
327+
# the Figure, and there's no file size benefit to compositing
328328
# with the Agg backend
329-
return False
329+
return True
330330

331331
def option_scale_image(self):
332332
"""

lib/matplotlib/backends/backend_macosx.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ def flipy(self):
170170
def points_to_pixels(self, points):
171171
return points/72.0 * self.dpi
172172

173-
def option_combine_images(self):
174-
return False
173+
def option_image_nocomposite(self):
174+
return True
175175

176176

177177
class GraphicsContextMac(_macosx.GraphicsContext, GraphicsContextBase):

lib/matplotlib/backends/backend_mixed.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def __init__(self, figure, width, height, dpi, vector_renderer,
6363
draw_path_collection draw_quad_mesh draw_tex draw_text
6464
finalize flipy get_canvas_width_height get_image_magnification
6565
get_texmanager get_text_width_height_descent new_gc open_group
66-
option_combine_images points_to_pixels strip_math
66+
option_image_nocomposite points_to_pixels strip_math
6767
start_filter stop_filter draw_gouraud_triangle
6868
draw_gouraud_triangles option_scale_image
6969
_text2path _get_text_path_transform height width

lib/matplotlib/backends/backend_pdf.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1577,12 +1577,12 @@ def option_scale_image(self):
15771577
"""
15781578
return True
15791579

1580-
def option_combine_images(self):
1580+
def option_image_nocomposite(self):
15811581
"""
1582-
return whether to combine multiple images on a set of axes into one
1583-
image
1582+
return whether to generate a composite image from multiple images on
1583+
a set of axes
15841584
"""
1585-
return rcParams['image.combine_images']
1585+
return not rcParams['image.composite_image']
15861586

15871587
def draw_image(self, gc, x, y, im, dx=None, dy=None, transform=None):
15881588
self.check_gc(gc)

lib/matplotlib/backends/backend_ps.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -452,12 +452,12 @@ def option_scale_image(self):
452452
"""
453453
return True
454454

455-
def option_combine_images(self):
455+
def option_image_nocomposite(self):
456456
"""
457-
return whether to combine multiple images on a set of axes into one
458-
image
457+
return whether to generate a composite image from multiple images on
458+
a set of axes
459459
"""
460-
return rcParams['image.combine_images']
460+
return not rcParams['image.composite_image']
461461

462462
def _get_image_h_w_bits_command(self, im):
463463
if im.is_grayscale:

lib/matplotlib/backends/backend_svg.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -527,15 +527,15 @@ def open_group(self, s, gid=None):
527527
def close_group(self, s):
528528
self.writer.end('g')
529529

530-
def option_combine_images(self):
530+
def option_image_nocomposite(self):
531531
"""
532-
if svg.image_noscale is True, combining multiple images into one is
533-
prohibited
532+
return whether to generate a composite image from multiple images on
533+
a set of axes
534534
"""
535535
if rcParams['svg.image_noscale']:
536-
return False
536+
return True
537537
else:
538-
return rcParams['image.combine_images']
538+
return not rcParams['image.composite_image']
539539

540540
def _convert_path(self, path, transform=None, clip=None, simplify=None):
541541
if clip:

lib/matplotlib/figure.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1045,16 +1045,16 @@ def draw(self, renderer):
10451045

10461046
# override the renderer default if self.suppressComposite
10471047
# is not None
1048-
combine_images = renderer.option_combine_images()
1048+
not_composite = renderer.option_image_nocomposite()
10491049
if self.suppressComposite is not None:
1050-
combine_images = not self.suppressComposite
1050+
not_composite = self.suppressComposite
10511051

1052-
if (len(self.images) <= 1 or not combine_images or
1052+
if (len(self.images) <= 1 or not_composite or
10531053
not cbook.allequal([im.origin for im in self.images])):
10541054
for a in self.images:
10551055
dsu.append((a.get_zorder(), a, a.draw, [renderer]))
10561056
else:
1057-
# make a combined image, blending alpha
1057+
# make a composite image blending alpha
10581058
# list of (_image.Image, ox, oy)
10591059
mag = renderer.get_image_magnification()
10601060
ims = [(im.make_image(mag), im.ox, im.oy, im.get_alpha())
@@ -1067,15 +1067,15 @@ def draw(self, renderer):
10671067
im.is_grayscale = False
10681068
l, b, w, h = self.bbox.bounds
10691069

1070-
def draw_combined_image():
1070+
def draw_composite():
10711071
gc = renderer.new_gc()
10721072
gc.set_clip_rectangle(self.bbox)
10731073
gc.set_clip_path(self.get_clip_path())
10741074
renderer.draw_image(gc, l, b, im)
10751075
gc.restore()
10761076

10771077
dsu.append((self.images[0].get_zorder(), self.images[0],
1078-
draw_combined_image, []))
1078+
draw_composite, []))
10791079

10801080
# render the axes
10811081
for a in self.axes:

lib/matplotlib/rcsetup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -595,9 +595,9 @@ def __call__(self, s):
595595
'image.lut': [256, validate_int], # lookup table
596596
'image.origin': ['upper', six.text_type], # lookup table
597597
'image.resample': [False, validate_bool],
598-
# Force vector graphics backends to combine all images on a set of axes
599-
# into a single image
600-
'image.combine_images': [True, validate_bool],
598+
# Specify whether vector graphics backends will combine all images on a
599+
# set of axes into a single composite image
600+
'image.composite_image': [True, validate_bool],
601601

602602
# contour props
603603
'contour.negative_linestyle': ['dashed',

lib/matplotlib/tests/test_backend_pdf.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,21 @@ def test_multipage_keep_empty():
8989

9090

9191
@cleanup
92-
def test_combine_images():
92+
def test_composite_image():
9393
#Test that figures can be saved with and without combining multiple images
94-
#(on a single set of axes) into a single image.
94+
#(on a single set of axes) into a single composite image.
9595
X, Y = np.meshgrid(np.arange(-5, 5, 1), np.arange(-5, 5, 1))
9696
Z = np.sin(Y ** 2)
9797
fig = plt.figure()
9898
ax = fig.add_subplot(1, 1, 1)
9999
ax.set_xlim(0, 3)
100100
ax.imshow(Z, extent=[0, 1, 0, 1])
101101
ax.imshow(Z[::-1], extent=[2, 3, 0, 1])
102-
plt.rcParams['image.combine_images'] = True
102+
plt.rcParams['image.composite_image'] = True
103103
with PdfPages(io.BytesIO()) as pdf:
104104
fig.savefig(pdf, format="pdf")
105105
assert len(pdf._file.images.keys()) == 1
106-
plt.rcParams['image.combine_images'] = False
106+
plt.rcParams['image.composite_image'] = False
107107
with PdfPages(io.BytesIO()) as pdf:
108108
fig.savefig(pdf, format="pdf")
109109
assert len(pdf._file.images.keys()) == 2

lib/matplotlib/tests/test_backend_ps.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -87,23 +87,23 @@ def test_savefig_to_stringio_with_usetex_eps():
8787

8888

8989
@cleanup
90-
def test_combine_images():
90+
def test_composite_image():
9191
#Test that figures can be saved with and without combining multiple images
92-
#(on a single set of axes) into a single image.
92+
#(on a single set of axes) into a single composite image.
9393
X, Y = np.meshgrid(np.arange(-5, 5, 1), np.arange(-5, 5, 1))
9494
Z = np.sin(Y ** 2)
9595
fig = plt.figure()
9696
ax = fig.add_subplot(1, 1, 1)
9797
ax.set_xlim(0, 3)
9898
ax.imshow(Z, extent=[0, 1, 0, 1])
9999
ax.imshow(Z[::-1], extent=[2, 3, 0, 1])
100-
plt.rcParams['image.combine_images'] = True
100+
plt.rcParams['image.composite_image'] = True
101101
with io.BytesIO() as ps:
102102
fig.savefig(ps, format="ps")
103103
ps.seek(0)
104104
buff = ps.read()
105105
assert buff.count(six.b(' colorimage')) == 1
106-
plt.rcParams['image.combine_images'] = False
106+
plt.rcParams['image.composite_image'] = False
107107
with io.BytesIO() as ps:
108108
fig.savefig(ps, format="ps")
109109
ps.seek(0)

lib/matplotlib/tests/test_backend_svg.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,23 @@ def test_noscale():
5656

5757

5858
@cleanup
59-
def test_combine_images():
59+
def test_composite_images():
6060
#Test that figures can be saved with and without combining multiple images
61-
#(on a single set of axes) into a single image.
61+
#(on a single set of axes) into a single composite image.
6262
X, Y = np.meshgrid(np.arange(-5, 5, 1), np.arange(-5, 5, 1))
6363
Z = np.sin(Y ** 2)
6464
fig = plt.figure()
6565
ax = fig.add_subplot(1, 1, 1)
6666
ax.set_xlim(0, 3)
6767
ax.imshow(Z, extent=[0, 1, 0, 1])
6868
ax.imshow(Z[::-1], extent=[2, 3, 0, 1])
69-
plt.rcParams['image.combine_images'] = True
69+
plt.rcParams['image.composite_image'] = True
7070
with BytesIO() as svg:
7171
fig.savefig(svg, format="svg")
7272
svg.seek(0)
7373
buff = svg.read()
7474
assert buff.count(six.b('<image ')) == 1
75-
plt.rcParams['image.combine_images'] = False
75+
plt.rcParams['image.composite_image'] = False
7676
with BytesIO() as svg:
7777
fig.savefig(svg, format="svg")
7878
svg.seek(0)

lib/matplotlib/tests/test_image.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ def test_image_edges():
248248

249249
assert g != 100, 'Expected a non-green edge - but sadly, it was.'
250250

251-
@image_comparison(baseline_images=['image_combine_background'], remove_text=True)
252-
def test_image_combine_background():
251+
@image_comparison(baseline_images=['image_composite_background'], remove_text=True)
252+
def test_image_composite_background():
253253
fig = plt.figure()
254254
ax = fig.add_subplot(111)
255255
arr = np.arange(12).reshape(4, 3)
@@ -258,8 +258,8 @@ def test_image_combine_background():
258258
ax.set_axis_bgcolor((1, 0, 0, 0.5))
259259
ax.set_xlim([0, 12])
260260

261-
@image_comparison(baseline_images=['image_combine_alpha'], remove_text=True)
262-
def test_image_combine_alpha():
261+
@image_comparison(baseline_images=['image_composite_alpha'], remove_text=True)
262+
def test_image_composite_alpha():
263263
"""
264264
Tests that the alpha value is recognized and correctly applied in the
265265
process of combining images together.

matplotlibrc.template

+2-2
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ backend : %(backend)s
358358
#image.lut : 256 # the size of the colormap lookup table
359359
#image.origin : upper # lower | upper
360360
#image.resample : False
361-
#image.combine_images : True # When True, all the images on a set of axes
362-
# are combined into a single image before
361+
#image.composite_image : True # When True, all the images on a set of axes are
362+
# combined into a single composite image before
363363
# saving a figure as a vector graphics file,
364364
# such as a PDF.
365365

0 commit comments

Comments
 (0)