cyberosa commited on
Commit
788db71
·
1 Parent(s): d24d85c

changing adjustments of third graph:

Browse files
Files changed (1) hide show
  1. tabs/market_plots.py +11 -7
tabs/market_plots.py CHANGED
@@ -87,8 +87,6 @@ def plot_trades_and_traders_ranking(market_metrics: pd.DataFrame) -> gr.Plot:
87
 
88
 
89
  def plot_wordcloud_topics(market_metrics: pd.DataFrame) -> gr.Plot:
90
- # Clear any existing matplotlib figures
91
- plt.clf()
92
  # Sort the data by 'nr_trades' in descending order
93
  market_metrics_sorted = market_metrics.sort_values(by="nr_trades", ascending=False)
94
  # Get the titles of the top 100 markets
@@ -120,11 +118,17 @@ def plot_wordcloud_topics(market_metrics: pd.DataFrame) -> gr.Plot:
120
 
121
  # Display the word cloud
122
  fig = plt.figure(figsize=(10, 5))
123
- plt.imshow(wordcloud, interpolation="bilinear")
124
- plt.axis("off")
125
- plt.title("Word Cloud of Market Titles")
126
- # Close the figure to prevent memory leaks
127
- plt.close()
 
 
 
 
 
 
128
  return gr.Plot(
129
  value=fig,
130
  )
 
87
 
88
 
89
  def plot_wordcloud_topics(market_metrics: pd.DataFrame) -> gr.Plot:
 
 
90
  # Sort the data by 'nr_trades' in descending order
91
  market_metrics_sorted = market_metrics.sort_values(by="nr_trades", ascending=False)
92
  # Get the titles of the top 100 markets
 
118
 
119
  # Display the word cloud
120
  fig = plt.figure(figsize=(10, 5))
121
+ ax = fig.add_subplot(111)
122
+
123
+ # Plot wordcloud using the axes object
124
+ ax.imshow(wordcloud, interpolation="bilinear")
125
+ ax.axis("off")
126
+ ax.set_title("Word Cloud of Market Titles")
127
+ # plt.imshow(wordcloud, interpolation="bilinear")
128
+ # plt.axis("off")
129
+ # plt.title("Word Cloud of Market Titles")
130
+ # # Close the figure to prevent memory leaks
131
+ # plt.close()
132
  return gr.Plot(
133
  value=fig,
134
  )