I'm trying to create a histogram using matplotlib
library.
I set encoding to UTF-8, but some of the polish characters (not all, only some) are missing.
I've tried to play around encode
and decode
, but without success.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import matplotlib.pyplot as plt
#sampleData
data=[[ 0.13837092, 0.14755699, 0.17719047, 0.1998352 ],
[ 0.19318216, 0.15863521, 0.17136143, 0.18979461]]
n, bins, patches = plt.hist(data, facecolor='green')
# I've tried also adding: .encode('UTF8') and .decode('UTF8'), but without success
plt.xlabel("Wartości ą, ć, ę, ł, ń, ó, ś, ź, ż.")
plt.ylabel("Prawdopodobieństwo ą, ć, ę, ł, ń, ó, ś, ź, ż.")
plt.title("Tytuł ą, ć, ę, ł, ń, ó, ś, ź, ż.")
plt.grid(True)
plt.savefig("sampleHist.png")
plt.clf()