Skip to content

Commit 9236f87

Browse files
Add title as option for TG bot (#152)
1 parent 1f246f0 commit 9236f87

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

fink_utils/tg_bot/utils.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ def get_curve(
273273
objectId=None,
274274
origin="API",
275275
ylabel="Difference magnitude",
276+
title=None,
276277
invert_yaxis=True,
277278
vline=None,
278279
hline=None,
@@ -306,6 +307,9 @@ def get_curve(
306307
Choose between `alert`, `API`[default], or `fields`.
307308
ylabel: str
308309
Label for y-axis. Default is `Difference magnitude`
310+
title: str
311+
Title for the plot. If None, `objectId` will be used.
312+
Default is None.
309313
invert_yaxis: bool
310314
Invert the y-axis. Default is True.
311315
vline: None or dictionary
@@ -412,6 +416,9 @@ def get_curve(
412416
jd = extract_field(alert, "jd")
413417
objectId = alert["objectId"]
414418

419+
if title is None:
420+
title = objectId
421+
415422
# Rescale dates
416423
dates = np.array([i - jd[-1] for i in jd])
417424

@@ -450,7 +457,7 @@ def get_curve(
450457
mew=4,
451458
alpha=0.5,
452459
)
453-
plt.title(objectId)
460+
plt.title(title)
454461

455462
if vline is not None:
456463
plt.axvline(vline["x"], ls="--", color="black", label=vline["x_label"])

0 commit comments

Comments
 (0)