lynn-twinkl
commited on
Commit
·
2d4c953
1
Parent(s):
65ec40d
first commit
Browse files- src/plot_histogram.py +18 -0
src/plot_histogram.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
import plotly.express as px
|
| 3 |
+
|
| 4 |
+
def plot_hist(df: pd.DataFrame, col_to_plot: str, bins: int, height: int = 500):
|
| 5 |
+
|
| 6 |
+
plt = px.histogram(
|
| 7 |
+
df,
|
| 8 |
+
x=col_to_plot,
|
| 9 |
+
nbins=bins,
|
| 10 |
+
color_discrete_sequence=['#646DEF']
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
plt.update_layout(
|
| 14 |
+
bargap=0.1,
|
| 15 |
+
height=height
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
return plt
|