Skip to content
Open
Changes from all commits
Commits
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
14 changes: 11 additions & 3 deletions mplexporter/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import matplotlib
from matplotlib import transforms, collections
from matplotlib.backends.backend_agg import FigureCanvasAgg
import numpy as np

class Exporter(object):
"""Matplotlib Exporter
Expand Down Expand Up @@ -239,13 +240,16 @@ def draw_collection(self, ax, collection,

offset_coords, offsets = self.process_transform(
transOffset, ax, offsets, force_trans=force_offsettrans)
if offset_coords == 'display':
# Transform offsets from display to data coordinates
inv = ax.transData.inverted()
offsets = inv.transform(offsets)
offset_coords = 'data'

path_coords = self.process_transform(
transform, ax, force_trans=force_pathtrans)

processed_paths = [utils.SVG_path(path) for path in paths]
processed_paths = [(self.process_transform(
transform, ax, path[0], force_trans=force_pathtrans)[1], path[1])
for path in processed_paths]

path_transforms = collection.get_transforms()
try:
Expand All @@ -255,6 +259,10 @@ def draw_collection(self, ax, collection,
except AttributeError:
# matplotlib 1.4: path transforms are already numpy arrays.
pass
if path_coords == 'axes':
path_transforms = [np.diag(np.diag(t) / np.diag(transOffset))
for t in path_transforms]
path_coords = 'display'

styles = {'linewidth': collection.get_linewidths(),
'facecolor': collection.get_facecolors(),
Expand Down