Skip to content

Commit

Permalink
Addressed more feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
lajohn4747 committed Nov 8, 2023
1 parent 6fbafaa commit 4341d76
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions sdmetrics/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,17 @@ def _generate_line_plot(real_data, synthetic_data, x_axis, y_axis, marker, annot
pd.api.types.is_numeric_dtype(all_data[x_axis])):
raise ValueError(
f"Sequence Index '{x_axis}' must contain numerical or datetime values only")
fig = px.line(all_data, x=x_axis, y=y_axis, color=marker, color_discrete_map={
'Real': PlotConfig.DATACEBO_DARK, 'Synthetic': PlotConfig.DATACEBO_GREEN
})
fig = px.line(all_data, x=x_axis, y=y_axis, color=marker,
color_discrete_map={
'Real': PlotConfig.DATACEBO_DARK,
'Synthetic': PlotConfig.DATACEBO_GREEN
})
if annotations:
fig.add_annotation(annotations)
if x_axis == 'sequence_index':
fig.update_xaxes(
title_text='Sequence Position'
)

fig.update_layout(
title_text=f"Real vs Synthetic Data for column: '{y_axis}'",
Expand All @@ -526,6 +532,7 @@ def _generate_line_plot(real_data, synthetic_data, x_axis, y_axis, marker, annot
name='Real-Min',
x=real_data[x_axis],
y=real_data['min'],
hoverinfo='skip',
marker={'color': 'rgba(0, 0, 54, 0.25)'},
showlegend=False,
mode='lines'
Expand All @@ -536,6 +543,7 @@ def _generate_line_plot(real_data, synthetic_data, x_axis, y_axis, marker, annot
name='Real-Max',
x=real_data[x_axis],
y=real_data['max'],
hoverinfo='skip',
marker={'color': 'rgba(0, 0, 54, 0.25)'},
showlegend=False,
mode='lines',
Expand All @@ -548,6 +556,7 @@ def _generate_line_plot(real_data, synthetic_data, x_axis, y_axis, marker, annot
name='Synthetic-Min',
x=synthetic_data[x_axis],
y=synthetic_data['min'],
hoverinfo='skip',
marker={'color': 'rgba(1, 224, 201, 0.25)'},
showlegend=False,
mode='lines'
Expand All @@ -558,6 +567,7 @@ def _generate_line_plot(real_data, synthetic_data, x_axis, y_axis, marker, annot
name='Synthetic-Max',
x=synthetic_data[x_axis],
y=synthetic_data['max'],
hoverinfo='skip',
marker={'color': 'rgba(1, 224, 201, 0.25)'},
showlegend=False,
mode='lines',
Expand Down

0 comments on commit 4341d76

Please sign in to comment.