1

I have a seaborn function as follows:

def plot(col,fig):
    tag = col.value_counts().sort_index(ascending=False)
    print(tag)
    f, ax = plt.subplots(figsize=fig)
    print(ax)
    sns.countplot(y=col, data=tag, color="b",order=col.value_counts().index,palette="Set1")

    total = len(col)
    for p in ax.patches:
            percentage = '{:.1f}%'.format(100 * p.get_width()/total)
            x = p.get_x() + p.get_width() + 0.02
            y = p.get_y() + p.get_height()/2
            ax.annotate(percentage, (x, y))

I am unable to render the text of the values on the y-axis. I am getting some random squares. The values of the plot on y-axis are in Japanese.

enter image description here

prb07
  • 67
  • 5
  • 1
    [this](https://stackoverflow.com/questions/21307832/how-to-display-chinese-in-pandas-plot) will help you. but you have to find a suitable font from `font/` folder – nipun Feb 12 '21 at 03:14
  • 1
    Looks like you need to use Unicode literals, which is supported in Matplotlib (and therefore Seaborn). See this question: https://stackoverflow.com/questions/40580584/use-unicode-text-with-seaborn – jbeldock Feb 12 '21 at 03:15

0 Answers0