Hi there,
I am creating an image with mathplotlib. This image is then shown an a web page.
now ma question.
the Image is set in a large gray area. I assume it is the space needed for the axis which I do not show.
How can I suppress this gray background?
thanks
robert
here the code I use to create the image:
def makeHlwdChart(self, values = ['a', 'd', 'e', 'f', 'b']):
# the need for following two lines I learned by appling voodoo and pdb
img_resource = self.context.restrictedTraverse('++resource++effizienz_balken_01.jpg')
imp_path = img_resource.context.path
pic = plt.imread(imp_path)
# the picture is upside down so rotate and fip it
pic = np.fliplr(np.rot90(pic, k=2))
# draw it on the canvas
plt.imshow(pic)
frame1 = plt.gca()
# hide axes
frame1.axes.get_xaxis().set_visible(False)
frame1.axes.get_yaxis().set_visible(False)
#frame1.subplots_adjust(left=0)
# generate the colored markers that denot the value
# write a label so, that it is within the marker
funs = [th, ge, hh, en, pr]
font0 = FontProperties()
font = font0.copy()
font.set_weight('bold')
for i in range(len(values)):
# add the colord marker
frame1.add_patch(funs[i](values[i], True))
# get postition of the label
p = funs[i](values[i], offset=TEXTOFFSET)
# write the label
frame1.text(p[0], p[1], values[i].upper(), fontproperties=font)
return pic