AttributeError: 'module' object has no attribute 'to_rgba'

 

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(20)
y = x**2

plt.plot(x, y)

在jupyter notebook中使用matplotlib画图出现这个错误,修正方法:

sudo pip install matplotlib==2.2.0

 

--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-36-6da7a0d23674> in <module> 13 height=2500 14 ) ---> 15 wordcloud.fit_words(num)#传入词频 16 17 #展示词云 C:\ProgramData\Anaconda3\lib\site-packages\wordcloud\wordcloud.py in fit_words(self, frequencies) 387 self 388 """ --> 389 return self.generate_from_frequencies(frequencies) 390 391 def generate_from_frequencies(self, frequencies, max_font_size=None): # noqa: C901 C:\ProgramData\Anaconda3\lib\site-packages\wordcloud\wordcloud.py in generate_from_frequencies(self, frequencies, max_font_size) 451 font_size = self.height 452 else: --> 453 self.generate_from_frequencies(dict(frequencies[:2]), 454 max_font_size=self.height) 455 # find font sizes C:\ProgramData\Anaconda3\lib\site-packages\wordcloud\wordcloud.py in generate_from_frequencies(self, frequencies, max_font_size) 506 font, orientation=orientation) 507 # get size of resulting text --> 508 box_size = draw.textbbox((0, 0), word, font=transposed_font, anchor="lt") 509 # find possible places using integral image: 510 result = occupancy.sample_position(box_size[3] + self.margin, C:\ProgramData\Anaconda3\lib\site-packages\PIL\ImageDraw.py in textbbox(self, xy, text, font, anchor, spacing, align, direction, features, language, stroke_width, embedded_color) 565 font = self.getfont() 566 mode = "RGBA" if embedded_color else self.fontmode --> 567 bbox = font.getbbox( 568 text, mode, direction, features, language, stroke_width, anchor 569 ) AttributeError: 'TransposedFont' object has no attribute 'getbbox'
06-07
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值