-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
42 lines (33 loc) · 855 Bytes
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
Author: Roberto Chiosa
Copyright: Roberto Chiosa, © 2024
Email: roberto.chiosa@pinvision.it
Created: 01/07/24
Script Name: utils.py
Path:
Script Description:
Notes:
"""
import pandas as pd
import plotly.express as px
from matplotlib import pyplot as plt
def plot_dynamic(data: pd.DataFrame) -> px:
"""
This function creates a dynamic plotly visualization
:param data: data to plot
:return: plotly figure
"""
fig = px.line(data)
return fig
def plot_static(data: pd.DataFrame) -> plt:
"""
This function creates a static matplotlib visualization
:param data: data to plot
:return: matplotlib figure
"""
# create a simple matplotlib visualization
plt.figure(figsize=(10, 6))
plt.plot(data)
plt.title('Simple plot')
plt.xlabel('x')
return plt