Skip to content

Commit a467d4f

Browse files
supporting xerrors on data
1 parent 9617fa0 commit a467d4f

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/sbmlsim/plot/plotting.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def __copy__(self) -> "Style":
291291

292292
# https://matplotlib.org/3.1.0/gallery/lines_bars_and_markers/linestyles.html
293293
MPL2SEDML_LINESTYLE_MAPPING = {
294-
294+
295295
"": LineType.NONE,
296296
"-": LineType.SOLID,
297297
"solid": LineType.SOLID,
@@ -1117,6 +1117,8 @@ def add_data(
11171117
self,
11181118
xid: str,
11191119
yid: str,
1120+
xid_sd=None,
1121+
xid_se=None,
11201122
yid_sd=None,
11211123
yid_se=None,
11221124
count: Union[int, str] = None,
@@ -1169,6 +1171,22 @@ def add_data(
11691171
if 'markeredgecolor' not in kwargs:
11701172
kwargs["markeredgecolor"] = "black"
11711173

1174+
# xerr data
1175+
xerr = None
1176+
xerr_label = ""
1177+
if xid_sd and xid_se:
1178+
logger.warning("'xid_sd' and 'xid_se' set, using 'xid_sd'.")
1179+
if xid_sd:
1180+
if xid_sd.endswith("se"):
1181+
logger.warning("SD error column ends with 'se', check names.")
1182+
xerr_label = "±SD"
1183+
xerr = Data(xid_sd, dataset=dataset, task=task)
1184+
elif xid_se:
1185+
if xid_se.endswith("sd"):
1186+
logger.warning("SE error column ends with 'sd', check names.")
1187+
xerr_label = "±SE"
1188+
xerr = Data(xid_se, dataset=dataset, task=task)
1189+
11721190
# yerr data
11731191
yerr = None
11741192
yerr_label = ""
@@ -1213,7 +1231,7 @@ def add_data(
12131231
self.curve(
12141232
x=Data(xid, dataset=dataset, task=task),
12151233
y=Data(yid, dataset=dataset, task=task),
1216-
xerr=None,
1234+
xerr=xerr,
12171235
yerr=yerr,
12181236
label=label,
12191237
type=type,

0 commit comments

Comments
 (0)