9c7f926d6d70a994c3710ce570bb9807519ef090,lib/matplotlib/backends/backend_agg.py,FigureCanvasAgg,print_png,#FigureCanvasAgg#Any#,456
Before Change
version_str = (
"matplotlib version " + __version__ + ", http://matplotlib.org/")
metadata = OrderedDict({"Software": version_str})
user_metadata = kwargs.pop("metadata", None)
if user_metadata is not None:
metadata.update(user_metadata)
with cbook._setattr_cm(renderer, dpi=self.figure.dpi), \
cbook.open_file_cm(filename_or_obj, "wb") as fh:
_png.write_png(renderer._renderer, fh,
After Change
**metadata,
}
if pil_kwargs is not None:
from PIL import Image
from PIL.PngImagePlugin import PngInfo
buf, size = self.print_to_buffer()
// Only use the metadata kwarg if pnginfo is not set, because the
// semantics of duplicate keys in pnginfo is unclear.
if "pnginfo" not in pil_kwargs:
pnginfo = PngInfo()
for k, v in metadata.items():
pnginfo.add_text(k, v)
pil_kwargs["pnginfo"] = pnginfo
pil_kwargs.setdefault("dpi", (self.figure.dpi, self.figure.dpi))
(Image.frombuffer("RGBA", size, buf, "raw", "RGBA", 0, 1)
.save(filename_or_obj, format="png", **pil_kwargs))
else:
FigureCanvasAgg.draw(self)
renderer = self.get_renderer()
with cbook._setattr_cm(renderer, dpi=self.figure.dpi), \
cbook.open_file_cm(filename_or_obj, "wb") as fh:
_png.write_png(renderer._renderer, fh,
self.figure.dpi, metadata=metadata)
def print_to_buffer(self):
FigureCanvasAgg.draw(self)
renderer = self.get_renderer()
with cbook._setattr_cm(renderer, dpi=self.figure.dpi):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: matplotlib/matplotlib
Commit Name: 9c7f926d6d70a994c3710ce570bb9807519ef090
Time: 2019-01-17
Author: anntzer.lee@gmail.com
File Name: lib/matplotlib/backends/backend_agg.py
Class Name: FigureCanvasAgg
Method Name: print_png
Project Name: elfi-dev/elfi
Commit Name: 23f7a6de9a581d18a1fb87582f50b6efb72e7683
Time: 2017-09-08
Author: jarno.lintusaari@aalto.fi
File Name: elfi/executor.py
Class Name: Executor
Method Name: get_execution_order
Project Name: flow-project/flow
Commit Name: 66189443c3b3b6cbd2c3b184878e61dde5c9618c
Time: 2018-02-21
Author: akreidieh@gmail.com
File Name: flow/scenarios/grid/grid_scenario.py
Class Name: SimpleGridScenario
Method Name: __init__