Skip to content

Commit 8e01cf4

Browse files
Measurement plot now as a strip if no msr_type provided
1 parent 6aeffff commit 8e01cf4

File tree

1 file changed

+9
-13
lines changed
  • python/nyx_space/plots

1 file changed

+9
-13
lines changed

python/nyx_space/plots/od.py

+9-13
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,6 @@ def overlay_measurements(
500500
if not isinstance(dfs, list):
501501
dfs = [dfs]
502502

503-
if fig is None:
504-
fig = go.Figure()
505-
506503
color_values = list(colors.values())
507504

508505
station_colors = {}
@@ -754,18 +751,16 @@ def plot_residual_histogram(
754751

755752
def plot_measurements(
756753
df,
757-
msr_type,
754+
msr_type=None,
758755
title=None,
759756
time_col_name="Epoch:Gregorian UTC",
760757
html_out=None,
761758
copyright=None,
762759
show=True,
763760
):
764761
"""
765-
Plot the provided measurement type, fuzzy matching of the column name
762+
Plot the provided measurement type, fuzzy matching of the column name, or plot all as a strip
766763
"""
767-
768-
msr_col_name = [col for col in df.columns if msr_type in col.lower()]
769764

770765
if title is None:
771766
# Build a title
@@ -796,9 +791,14 @@ def plot_measurements(
796791
df["time_col"] = pd.Series(pd_ok_epochs)
797792
x_title = "Epoch {}".format(time_col_name[-3:])
798793

799-
fig = px.scatter(df, x="time_col", y=msr_col_name, color="Tracking device")
794+
if msr_type is None:
795+
fig = px.strip(df, x="time_col", y="Tracking device", color="Tracking device")
796+
finalize_plot(fig, title, x_title, "All tracking data", copyright)
797+
else:
798+
msr_col_name = [col for col in df.columns if msr_type in col.lower()]
800799

801-
finalize_plot(fig, title, x_title, msr_col_name[0], copyright)
800+
fig = px.scatter(df, x="time_col", y=msr_col_name, color="Tracking device")
801+
finalize_plot(fig, title, x_title, msr_col_name[0], copyright)
802802

803803
if html_out:
804804
with open(html_out, "w") as f:
@@ -809,7 +809,3 @@ def plot_measurements(
809809
fig.show()
810810
else:
811811
return fig
812-
813-
if __name__ == "__main__":
814-
df = pd.read_parquet("output_data/msr-2023-11-25T06-14-01.parquet")
815-
plot_measurements(df, "range")

0 commit comments

Comments
 (0)