我知道这个问题已经被问过好几次了,但是我仍然无法弄清楚我的问题的答案。我不断收到相同的错误,不知道如何解决。
这是我的代码:
from Tkinter import *
from PIL import Image, ImageTk
import os
window = Tk()
i = Image.open(pathToImage)
if os.path.isfile(pathToImage):
print 'image exists'
else:
print 'image does not exits'
label=Label(window, image=i)
label.pack()
window.mainloop()
Run Code Online (Sandbox Code Playgroud)
它说图像存在于指定的路径,但是我不断收到此错误消息:
Traceback (most recent call last):
File "ImageTest.py", line 31, in <module>
label=Label(window, image=i)
File "C:\Users\username\Anaconda2\lib\lib-tk\Tkinter.py", line 2597, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "C:\Users\username\Anaconda2\lib\lib-tk\Tkinter.py", line 2096, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: image "<PIL.PngImagePlugin.PngImageFile image mode=RGBA size=640x480 at 0x36DF278>" doesn't …Run Code Online (Sandbox Code Playgroud) 我对 gnuplot 还很陌生,所以我很感谢每一个建议。
现在,我正在尝试使用 logscale 命令绘制一些数据。但我不知道为什么当我使用对数刻度时所有 xtics 都会消失。这是我使用的脚本:
#creates a plot of all the four different loops with a logscale. Fits the functions as well and saves the fitting data
#in a file named fitting.dat
set size 1,1
# set logscale
set logscale y 10
set logscale x 10
#set xlabel and y label
set xlabel "Dimension of Matrix"
set ylabel "time [s]"
#scale plot
set xrange [450:850]
set yrange[0.01:5]
#nothing displayed from fitting
set fit quiet
#position of legend …Run Code Online (Sandbox Code Playgroud)