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
21 changes: 19 additions & 2 deletions stingray/lightcurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -1635,9 +1635,10 @@ def plot(
if not self.input_counts:
flux_attr = "countrate"

return super().plot(
# 1. Let the parent plot the main points (We force witherrors=False so it doesn't try and fail)
ax = super().plot(
flux_attr,
witherrors=witherrors,
witherrors=False,
labels=labels,
ax=ax,
title=title,
Expand All @@ -1648,6 +1649,22 @@ def plot(
axis_limits=axis_limits,
)

# 2. Manually plot the error bars ourselves
if witherrors:
err_col = flux_attr + "_err"
# Only try to plot if the error data actually exists
if hasattr(self, err_col):
ax.errorbar(
self.time,
getattr(self, flux_attr),
yerr=getattr(self, err_col),
fmt="none", # "none" means don't draw the dots again (parent already did)
ecolor="k", # Black error bars (optional, but looks standard)
zorder=10
)

return ax

@classmethod
def read(
cls, filename, fmt=None, format_=None, err_dist="gauss", skip_checks=False, **fits_kwargs
Expand Down
Loading