1

While running on my virtualenv I wrote this code on terminal and plot via matplotlib and shows me a 'Figure 1' named window with no drawing/content and throws 'TypeError' meanwhile:

(cv) pi@raspberrypi:~ $ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04) 
[GCC 6.3.0 20170124] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> from matplotlib import pyplot as plt
>>> x=[1,2,3,4]
>>> y=[2,4,6,8]
>>> plt.plot(x,y)
[<matplotlib.lines.Line2D object at 0x6fd4ca10>]
>>> plt.show()
TypeError: Couldn't find foreign struct converter for 'cairo.Context'
TypeError: Couldn't find foreign struct converter for 'cairo.Context'
TypeError: Couldn't find foreign struct converter for 'cairo.Context'
TypeError: Couldn't find foreign struct converter for 'cairo.Context'

I'm using Stretch version of RaspBian. I had installed matplotlib with sudo pip install matplotlib and tried this, also installed some dependent packages. What can I do?

Secondly are there any other way to draw histogram of image in opencv without matplotlib library?

user70
  • 597
  • 2
  • 7
  • 24

0 Answers0