Skip to content

Commit

Permalink
fix flags in plot legend (#74)
Browse files Browse the repository at this point in the history
values did not match PhotoPolResult.FLAGS
  • Loading branch information
juanep97 authored Jan 11, 2024
1 parent 13880cc commit d8dfafa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions iop4api/views/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ def get_invariable_str(s):
#################################################

# Create a ColumnDataSource with data for Circle and Star glyphs

legend_source = ColumnDataSource(data=dict(x=[0], y=[0]))

label_stylesheet = InlineStyleSheet(css="""
Expand Down Expand Up @@ -626,6 +627,8 @@ def get_invariable_str(s):

legend_row_L = list()

# Instrument legend entries

for instrument, color in zip(instruments_L, instrument_color_L):
# Create Div elements for labels
label = Div(text=f"""<label><span>{instrument}</span><input onclick="plot_hide_instrument(this);" data-instrument="{instrument}" type="checkbox" checked/></label>""", height=21, stylesheets=[label_stylesheet])
Expand All @@ -644,9 +647,12 @@ def get_invariable_str(s):

legend_row_L.append(legend_row)

for flag_value, flag_label, marker in zip([1,2,3], ["bad photometry", "bad polarimetry", "bad photometry and polarimetry"], ["triangle", "inverted_triangle", "cross"]):
# Flag legend entries
# values here must match those in PhotoPolResult.FLAGS (0, 1 << 1 = 2, 1 << 2 = 4, 1 << 1 | 1 << 2 = 6)

for flag_value, flag_label, marker in zip([2,4,6], ["bad photometry", "bad polarimetry", "bad photometry and polarimetry"], ["triangle", "inverted_triangle", "cross"]):
# Create Div elements for labels
if flag_value in [1,2]:
if flag_value in [2,4]:
cbox = f"""<input onclick="plot_hide_flag(this);" data-flag="{flag_value}" type="checkbox" checked/>"""
no_pointer = ""
else:
Expand Down

0 comments on commit d8dfafa

Please sign in to comment.