Skip to content

Commit

Permalink
remove all incidences of plt.show() to keep chaining working
Browse files Browse the repository at this point in the history
the inline backend would break after a plt.show() while nbagg could cope with
it, very confusing. Now if one needs a show() somewhere, one needs to add it
somewhere else.
Also, added **kwargs hand-on to markings plot function from plotting module
  • Loading branch information
michaelaye committed May 11, 2016
1 parent 570a827 commit 5eee43a
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions planet4/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def plot_image_id_pipeline(image_id, **kwargs):

fig.subplots_adjust(left=None, top=None, bottom=None, right=None,
wspace=0.001, hspace=0.001)
plt.show()
if save:
fname = "{}_{}.pdf".format(imgid.imgid, savetitle)
fpath = pm.fnotched_dir / fname
Expand All @@ -38,14 +37,12 @@ def plot_raw_fans(id_, ax=None):
imgid = markings.ImageID(id_)

imgid.plot_fans(ax=ax)
plt.show()


def plot_raw_blotches(id_, ax=None):
imgid = markings.ImageID(id_)

imgid.plot_blotches(ax=ax)
plt.show()


def plot_finals(id_, _dir=None, ax=None):
Expand All @@ -64,19 +61,17 @@ def plot_finals(id_, _dir=None, ax=None):
_, ax = plt.subplots()
imgid.plot_fans(ax=ax, fans=finalfans.content)
imgid.plot_blotches(ax=ax, blotches=finalblotches.content)
plt.show()


def plot_clustered_blotches(id_, _dir=None, ax=None):
def plot_clustered_blotches(id_, _dir=None, ax=None, **kwargs):
pm = io.PathManager(id_=id_, datapath=_dir)
if not pm.reduced_blotchfile.exists():
print("Clustered blotchfile not found")
return
reduced_blotches = markings.BlotchContainer.from_fname(pm.reduced_blotchfile)
imgid = markings.ImageID(id_)

imgid.plot_blotches(blotches=reduced_blotches.content, ax=ax)
plt.show()
imgid.plot_blotches(blotches=reduced_blotches.content, ax=ax, **kwargs)


def blotches_all(id_, _dir=None):
Expand All @@ -85,19 +80,17 @@ def blotches_all(id_, _dir=None):
plot_clustered_blotches(id_, _dir, ax=axes[1])
fig.subplots_adjust(left=None, top=None, bottom=None, right=None,
wspace=0.001, hspace=0.001)
plt.show()


def plot_clustered_fans(id_, _dir=None, ax=None):
def plot_clustered_fans(id_, _dir=None, ax=None, **kwargs):
pm = io.PathManager(id_=id_, datapath=_dir)
if not pm.reduced_fanfile.exists():
print("Clustered/reduced fanfile not found")
return
reduced_fans = markings.FanContainer.from_fname(pm.reduced_fanfile)
imgid = markings.ImageID(id_)

imgid.plot_fans(fans=reduced_fans.content, ax=ax)
plt.show()
imgid.plot_fans(fans=reduced_fans.content, ax=ax, **kwargs)


def fans_all(id_, _dir=None):
Expand All @@ -106,4 +99,3 @@ def fans_all(id_, _dir=None):
plot_clustered_fans(id_, _dir, ax=axes[1])
fig.subplots_adjust(left=None, top=None, bottom=None, right=None,
wspace=0.001, hspace=0.001)
plt.show()

0 comments on commit 5eee43a

Please sign in to comment.