mgbam commited on
Commit
bf400de
·
verified ·
1 Parent(s): b8b8eab

Create visuals.py

Browse files
Files changed (1) hide show
  1. tools/visuals.py +25 -0
tools/visuals.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import plotly.express as px
3
+
4
+ def histogram_tool(file_path: str, column: str):
5
+ df = pd.read_csv(file_path)
6
+ fig = px.histogram(df, x=column, nbins=30, title=f"Histogram – {column}", template="plotly_dark")
7
+ return fig
8
+
9
+ def scatter_matrix_tool(file_path: str, cols: list[str]):
10
+ df = pd.read_csv(file_path)
11
+ fig = px.scatter_matrix(df[cols], title="Scatter‑Matrix", template="plotly_dark")
12
+ return fig
13
+
14
+ def corr_heatmap_tool(file_path: str):
15
+ df = pd.read_csv(file_path).select_dtypes("number")
16
+ corr = df.corr(numeric_only=True)
17
+ fig = px.imshow(
18
+ corr,
19
+ color_continuous_scale="RdBu",
20
+ title="Correlation Heat‑map",
21
+ aspect="auto",
22
+ labels=dict(color="ρ"),
23
+ template="plotly_dark",
24
+ )
25
+ return fig