简体   繁体   中英

How to resolve unknown Python reference to dependency 'mpl_toolkits' in PyCharm?

When i run it without the cmap=cm.hsv call i get an empty plot 当我没有cmap=cm.hsv调用运行它时,我得到一个空图
with the error: .../lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py:1673: RuntimeWarning: invalid value encountered in divide for n in normals])

在此处输入图片说明

Unresolved references for mpl_toolkits and cm
(am betting cm is from mpl_toolkits)
I have tried Invalidating Caches & Restarting (as well as manually readding the path to mpl_toolkits)
with no success.

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

I hadnt imported cm
from matplotlib import cm
and i needed to import mplot3d like
from mplot3d import Axes3D instead of
from mpl_toolkits.mplot3d import Axes3D
My data was not ranged correctly too (why nothing was showing). Needed to range form -10 to 10, i had left out the minus sign.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM