我正在尝试根据pycharm中的以下代码生成一个简单的matplotlib图形。
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 5, 11)
y = x ** 2
fig = plt.figure()
axes1 = fig.add_axes([0.1,0.1,0.8,0.8])
axes2 = fig.add_axes([0.2,0.5,0.4,0.3])
axes1.plot(x,y)
axes2.plot(y,x)
axes1.set_xlabel('X_1 label')
axes1.set_ylabel('Y_1 label')
axes1.set_title('Title_1')
axes2.set_xlabel('X_2 label')
axes2.set_ylabel('Y_2 label')
axes2.set_title('Title_2')
我遇到错误
/home/lk/anaconda3/envs/pycharm/bin/python "/home/lk/Desktop/Python Exps/pycharm/tr.py"
QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '/run/user/1000/snap.pycharm-community', please create it with 0700 permissions.
Process finished with exit code 0
此错误的含义是什么,我该如何解决?
答案 0 :(得分:3)
只需使用以下内容创建目录:
$ mkdir -p /run/user/1000/snap.pycharm-community
并按如下所示更改其权限:
$ chmod 0700 /run/user/1000/snap.pycharm-community
或者,您可以设置环境变量XDG_RUNTIME_DIR
:
$ export XDG_RUNTIME_DIR=/your/dir