Ashoka74 commited on
Commit
3f33ebc
·
verified ·
1 Parent(s): a0b5bde

Update map.py

Browse files
Files changed (1) hide show
  1. map.py +5 -3
map.py CHANGED
@@ -196,8 +196,8 @@ def plot_line(df, x_column, y_columns, figsize=(12, 10), color='orange', title=N
196
  ax.patch.set_alpha(0)
197
 
198
  return fig
199
-
200
- def plot_bar(df, x_column, y_column, figsize=(12, 10), color='orange', title=None):
201
  fig, ax = plt.subplots(figsize=figsize)
202
 
203
  sns.barplot(data=df, x=x_column, y=y_column, color=color, ax=ax)
@@ -209,6 +209,8 @@ def plot_bar(df, x_column, y_column, figsize=(12, 10), color='orange', title=Non
209
  ax.tick_params(axis='x', colors=color)
210
  ax.tick_params(axis='y', colors=color)
211
 
 
 
212
  # Remove background
213
  fig.patch.set_alpha(0)
214
  ax.patch.set_alpha(0)
@@ -380,8 +382,8 @@ def filter_dataframe(df: pd.DataFrame) -> pd.DataFrame:
380
  user_date_input = tuple(map(pd.to_datetime, user_date_input))
381
  start_date, end_date = user_date_input
382
  df_ = df_.loc[df_[column].between(start_date, end_date)]
 
383
  date_column = column
384
-
385
  # convert back to str for the map
386
  df_[column] = df_[column].dt.strftime('%Y-%m-%d %H:%M:%S')
387
 
 
196
  ax.patch.set_alpha(0)
197
 
198
  return fig
199
+
200
+ def plot_bar(df, x_column, y_column, figsize=(12, 10), color='orange', title=None, rotation=45):
201
  fig, ax = plt.subplots(figsize=figsize)
202
 
203
  sns.barplot(data=df, x=x_column, y=y_column, color=color, ax=ax)
 
209
  ax.tick_params(axis='x', colors=color)
210
  ax.tick_params(axis='y', colors=color)
211
 
212
+ plt.xticks(rotation=rotation)
213
+
214
  # Remove background
215
  fig.patch.set_alpha(0)
216
  ax.patch.set_alpha(0)
 
382
  user_date_input = tuple(map(pd.to_datetime, user_date_input))
383
  start_date, end_date = user_date_input
384
  df_ = df_.loc[df_[column].between(start_date, end_date)]
385
+
386
  date_column = column
 
387
  # convert back to str for the map
388
  df_[column] = df_[column].dt.strftime('%Y-%m-%d %H:%M:%S')
389