clearml-docs/docs/guides/reporting/plotly_reporting.md

38 lines
1.2 KiB
Markdown
Raw Normal View History

2021-05-13 23:48:51 +00:00
---
title: Plotly Reporting
---
The [plotly_reporting.py](https://github.com/allegroai/clearml/blob/master/examples/reporting/plotly_reporting.py) example
2022-03-13 13:07:06 +00:00
demonstrates ClearML's Plotly integration and reporting.
2021-05-13 23:48:51 +00:00
2022-03-13 13:07:06 +00:00
Report Plotly plots in ClearML by calling the [`Logger.report_plotly`](../../references/sdk/logger.md#report_plotly) method, and passing a complex
2021-05-13 23:48:51 +00:00
Plotly figure, using the `figure` parameter.
2023-09-13 07:58:54 +00:00
In this example, the Plotly figure is created using `plotly.express.scatter` (see the [Plotly documentation](https://plotly.com/python/line-and-scatter/)):
2021-05-13 23:48:51 +00:00
2021-12-14 13:12:30 +00:00
```python
# Iris dataset
df = px.data.iris()
2021-05-13 23:48:51 +00:00
2021-12-14 13:12:30 +00:00
# create complex plotly figure
fig = px.scatter(
df,
x="sepal_width",
y="sepal_length",
color="species",
marginal_y="rug",
marginal_x="histogram"
)
2021-05-13 23:48:51 +00:00
2021-12-14 13:12:30 +00:00
# report the plotly figure
task.get_logger().report_plotly(
title="iris", series="sepal", iteration=0, figure=fig
)
```
2021-05-13 23:48:51 +00:00
2023-09-04 12:40:42 +00:00
When the script runs, it creates an experiment named `plotly reporting` in the examples project.
2021-05-13 23:48:51 +00:00
2023-09-13 07:58:54 +00:00
ClearML reports Plotly figures, and displays them in the **ClearML Web UI** **>** experiment details **>** **PLOTS**
2022-05-22 07:27:30 +00:00
tab.
2021-05-13 23:48:51 +00:00
2023-09-13 07:58:54 +00:00
![Web UI experiment plots](../../img/examples_reporting_13.png)