I am working on my thesis on Bnagla News headline relevancy. I want to visualize my data in pyplot graph. Here is an example of my code:
import matplotlib.pyplot as plt
column_name = 'News'
# Step 2: Calculate term frequency
sample_size = 50000
df_sample = df.sample(n=sample_size, random_state=42)
# Step 3: Calculate term frequency
term_frequency = df_sample[column_name].str.lower().str.split(expand=True).stack().value_counts()
# Step 4: Plot the top N terms with the highest frequencies in a bar chart
top_n = 10 # Change this value to plot more or fewer top terms
top_terms = term_frequency.head(top_n)
plt.figure(figsize=(10, 6))
plt.bar(top_terms.index, top_terms.values)
plt.xlabel('Terms')
plt.ylabel('Frequency')
plt.title(f'Top {top_n} Terms by Frequency (Sampled 50,000 rows)')
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()
Here is how the graph look like: Plot terms is not showing properly In the image the bangla text which frequency is represented in the graph is not showing properly. Also my code is showing this warning: :22: UserWarning: Glyph 2451 (\N{BENGALI LETTER O}) missing from current font. plt.tight_layout() :22: UserWarning: Matplotlib currently does not support Bengali natively. plt.tight_layout() :22: UserWarning: Glyph 2469 (\N{BENGALI LETTER THA}) missing from current font. plt.tight_layout() :22: UserWarning: Glyph 2503 (\N{BENGALI VOWEL SIGN E}) missing from current font. plt.tight_layout() :22: UserWarning: Glyph 2453 (\N{BENGALI LETTER KA}) missing from current font. plt.tight_layout() :22: UserWarning: Glyph 2480 (\N{BENGALI LETTER RA}) missing from current font. plt.tight_layout() :22: UserWarning: Glyph 2447 (\N{BENGALI LETTER E}) missing from current font. plt.tight_layout() :22: UserWarning: Glyph 2494 (\N{BENGALI VOWEL SIGN AA}) missing from current font. plt.tight_layout() :22: UserWarning: Glyph 2507 (\N{BENGALI VOWEL SIGN O}) missing from current font. plt.tight_layout() :22: UserWarning: Glyph 2472 (\N{BENGALI LETTER NA}) missing from current font. plt.tight_layout() :22: UserWarning: Glyph 2439 (\N{BENGALI LETTER I}) missing from current font. plt.tight_layout() :22: UserWarning: Glyph 2476 (\N{BENGALI LETTER BA}) missing from current font. plt.tight_layout() :22: UserWarning: Glyph 2434 (\N{BENGALI SIGN ANUSVARA}) missing from current font. plt.tight_layout() :22: UserWarning: Glyph 2489 (\N{BENGALI LETTER HA}) missing from current font. plt.tight_layout() :22: UserWarning: Glyph 2460 (\N{BENGALI LETTER JA}) missing from current font. plt.tight_layout() :22: UserWarning: Glyph 2482 (\N{BENGALI LETTER LA}) missing from current font. plt.tight_layout() /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2451 (\N{BENGALI LETTER O}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Matplotlib currently does not support Bengali natively. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2469 (\N{BENGALI LETTER THA}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2503 (\N{BENGALI VOWEL SIGN E}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2453 (\N{BENGALI LETTER KA}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2480 (\N{BENGALI LETTER RA}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2447 (\N{BENGALI LETTER E}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2494 (\N{BENGALI VOWEL SIGN AA}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2507 (\N{BENGALI VOWEL SIGN O}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2472 (\N{BENGALI LETTER NA}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2439 (\N{BENGALI LETTER I}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2476 (\N{BENGALI LETTER BA}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2434 (\N{BENGALI SIGN ANUSVARA}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2489 (\N{BENGALI LETTER HA}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2460 (\N{BENGALI LETTER JA}) missing from current font. fig.canvas.print_figure(bytes_io, **kw) /usr/local/lib/python3.10/dist-packages/IPython/core/pylabtools.py:151: UserWarning: Glyph 2482 (\N{BENGALI LETTER LA}) missing from current font. fig.canvas.print_figure(bytes_io, **kw)
I want a proper solution that will visualize the Bangla Text in the plot. Which font I should include and why this is hapening? I want the solution to progress my thesis.