Matplotlib plotting some characters as blank square

不打扰是莪最后的温柔 提交于 2021-01-28 08:22:15

问题


I'm working on reading some photos and taking the text with OCR. Now I need to rank the text read into some graph in order to see some pattern. But when I try to plot those texts into a graph, I got blank squares in the place of some characters. I'm sharing a example of what I've done with a script:

This is an example script:

import numpy as np
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
y = [0,1,2,3]
group_labels = ['77 7 7 7\r\nlfISldI\r\n\r\n',
                'G217\r\nini\r\n\r\n', 
                'L519\r\nini\r\n\r\n',
                'QED\r\n\r\n']

ax.set_yticks(y)
ax.tick_params(axis='both', which='major', labelsize=15)
ax.set_yticklabels(group_labels, minor=False)

plt.show()

This is the graph it generates:

My goal is that the graph plotted has the same text as written in the 'group_labels' list.

来源:https://stackoverflow.com/questions/56908589/matplotlib-plotting-some-characters-as-blank-square

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!