Skip to content
Snippets Groups Projects
Commit 64938148 authored by ChiWai Chan's avatar ChiWai Chan
Browse files

horizon.py: add limits and title options for horizon distance plots.

parent a369b614
No related branches found
No related tags found
1 merge request!114Plot horizon distance from ranking statistics
......@@ -133,7 +133,7 @@ class HorizonDistance:
raise UnknownExtensionError("Cannot determine the extension of the input data sources, please prepare files with the following extension: ('.gz' or '.cache').")
def savefig(self, output, figsize=(12,4)):
def savefig(self, output, figsize=(12,4), limits=None, title=None):
"""Save the horizon distance plot to disk.
Args:
......@@ -142,11 +142,18 @@ class HorizonDistance:
figsize:
tuple of float, default (12,4), set the output
figure size in inch.
limits:
list of float, default to auto detection, set
the limits on horizon distance.
title:
str, the title of the plots.
Returns:
None
"""
fig, ax = pyplot.subplots(1, 2, figsize = figsize)
if title is not None:
fig.suptitle(title)
pyplot.tight_layout(pad = 4, w_pad = 4, h_pad = 4)
mint = int(min([min(horizon_history.keys()) for _, horizon_history in self.horizon_history_dict.items()]))
......@@ -162,6 +169,9 @@ class HorizonDistance:
ax[0].semilogy(SinceGPSTime, horizon_dist, "x", color = plotutil.colour_from_instruments([ifo]), label = ifo)
ax[1].hist(horizon_dist, binvec, alpha = 0.5, color = plotutil.colour_from_instruments([ifo]), label = ifo)
if limits is not None:
ax[0].set_ylim(limits)
ax[1].set_xlim(limits)
if self.verbose:
sys.stderr.write("plotting " + str(output) + "\n")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment