sdv-dev / SDMetrics

Metrics to evaluate quality and efficacy of synthetic datasets.
https://docs.sdv.dev/sdmetrics
MIT License
201 stars 44 forks source link

Figures are not shown on VSCode #528

Closed R-Palazzo closed 5 months ago

R-Palazzo commented 9 months ago

Environment Details

When I run:

from sdmetrics.demos import load_demo
from sdmetrics.reports.single_table import QualityReport

real_data, synthetic_data, metadata = load_demo(modality='single_table')
report = QualityReport()

report.generate(real_data, synthetic_data, metadata)
fig = report.get_visualization('Column Shapes')
fig.show()

On my notebook on vscode, I can't see the figure.

Workaround

Doing: fig.show(renderers='vscode') instead of fig.show() should work.

Modifying this line: https://github.com/sdv-dev/SDMetrics/blob/004fbbe59a4abca3de920ffee96f451a907f7186/sdmetrics/visualization.py#L34 To this: pio.renderers.default = 'vscode+iframe'

fixes the issue on vscode

srinify commented 5 months ago

I was looking through our older issues around plots not rendering in VSCode Jupyter experience and starting close them out. The issue isn't related to any of the SDV libraries and requires just a single line code (which @R-Palazzo rightly points out involves just changing the renderer for plotly).

https://github.com/sdv-dev/SDV/issues/1734#issuecomment-2027740751