我有一个散点图,其中我指定了图例和x和y标签,但是当我绘制时,我的刻度线,图例和x和y轴标签不显示。我正在使用最新版本的Anaconda python发行版并直接在Spyder中运行我的文件。如果我在IDLE中运行脚本,那么一切都会显示出来。我的情节的精简版如下:
import matplotlib.pyplot as plt
import numpy
from matplotlib import rc
CA_90_60 = ([(1.3495843761596 , 0.186363275611754)])
CA_90_120 = ([(26.5436500747458 , 3.66551548830712)])
clearanceline_co = [2,2,1.9,1.8,1.7,1.6,1.5,1.4,1.3,1.2,1.1,1,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,10e-8,0]
clearanceline_eu = [0,10e-8,0.005,0.01,0.015,0.02,0.025,0.03,0.035,0.04,0.045,0.05,0.055,0.06,0.065,0.07,0.075,0.08,0.085,0.09,0.095,0.1,0.1]
y_co = [1,1,1,1,1,1,1e-1,1e-2,1e-3,0]
x_co = [0,1e-4,1e-3,1e-2,1e-1,1e0,1e0,1e0,1e0,1e0]
plt.rcParams['legend.loc'] = 'best'
plt.figure(1)
n = plt.scatter(*zip(*CA_90_60) , c=numpy.random.rand(3,1) , marker= '+',s=100)
o = plt.scatter(*zip(*CA_90_120) , c=numpy.random.rand(3,1) , marker= '+',s=100)
clearance, = plt.plot(clearanceline_eu, clearanceline_co, color='g')
rc('text', usetex=True)
plt.ylim(10e-5, 10e4)
plt.xlim(10e-6, 10e3)
plt.loglog()
plt.xlabel('Europium (ppm)')
plt.ylabel('Cobalt (ppm)')
plt.legend([n, o, clearance],
[ "60 min at 90 kW" , "120 min at 90 kW" , r'$\Sigma = \frac{C_i}{CL} = 1.0$' ] , scatterpoints = 1)
print('plots created')
plt.show()
如何让我的情节在Spyder中正确显示?
编辑:以下是我使用的软件包的一些版本号:
Spyder中的matplotlib版本1.4.2和空闲
matplotlib位置(spyder和idle):/ Users / steve / anaconda / lib / python2.7 / site-packages / matplotlib / init .pyc
NumPy还会在IDLE和Spyder中检出相同的版本和位置。