Skip to content
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

changed plotting return types #184

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
11 changes: 4 additions & 7 deletions ternary/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ def plot(points, ax=None, permutation=None, **kwargs):
if not ax:
fig, ax = plt.subplots()
xs, ys = project_sequence(points, permutation=permutation)
ax.plot(xs, ys, **kwargs)
return ax
return ax.plot(xs, ys, **kwargs)


def plot_colored_trajectory(points, cmap=None, ax=None, permutation=None,
Expand Down Expand Up @@ -111,9 +110,7 @@ def plot_colored_trajectory(points, cmap=None, ax=None, permutation=None,

line_segments = matplotlib.collections.LineCollection(segments, cmap=cmap, **kwargs)
line_segments.set_array(np.arange(len(segments)))
ax.add_collection(line_segments)

return ax
return ax.add_collection(line_segments)


def scatter(points, ax=None, permutation=None, colorbar=False, colormap=None,
Expand Down Expand Up @@ -145,7 +142,7 @@ def scatter(points, ax=None, permutation=None, colorbar=False, colormap=None,
if not ax:
fig, ax = plt.subplots()
xs, ys = project_sequence(points, permutation=permutation)
ax.scatter(xs, ys, vmin=vmin, vmax=vmax, **kwargs)
ax_points = ax.scatter(xs, ys, vmin=vmin, vmax=vmax, **kwargs)

if colorbar and (colormap != None):
if cb_kwargs != None:
Expand All @@ -155,4 +152,4 @@ def scatter(points, ax=None, permutation=None, colorbar=False, colormap=None,
colorbar_hack(ax, vmin, vmax, colormap, scientific=scientific,
cbarlabel=cbarlabel)

return ax
return ax_points
10 changes: 5 additions & 5 deletions ternary/ternary_axes_subplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def close(self):

def legend(self, *args, **kwargs):
ax = self.get_axes()
ax.legend(*args, **kwargs)
return ax.legend(*args, **kwargs)

def savefig(self, filename, **kwargs):
self._redraw_labels()
Expand Down Expand Up @@ -425,14 +425,14 @@ def scatter(self, points, **kwargs):
def plot(self, points, **kwargs):
ax = self.get_axes()
permutation = self._permutation
plotting.plot(points, ax=ax, permutation=permutation,
**kwargs)
return plotting.plot(points, ax=ax, permutation=permutation,
**kwargs)

def plot_colored_trajectory(self, points, cmap=None, **kwargs):
ax = self.get_axes()
permutation = self._permutation
plotting.plot_colored_trajectory(points, cmap=cmap, ax=ax,
permutation=permutation, **kwargs)
return plotting.plot_colored_trajectory(points, cmap=cmap, ax=ax,
permutation=permutation, **kwargs)

def heatmap(self, data, scale=None, cmap=None, scientific=False,
style='triangular', colorbar=True, use_rgba=False,
Expand Down