我将图像叠加在另一张图像上,结果如下图所示:
左边是默认图像,某些质量细节中缺少蓝色部分。右边是放大蓝色部分
有没有办法改善matlibplot上的图像质量细节?它目前缺少黑色边框细节。它实际上是放大图像的时候。
感谢您的帮助。
回复以下评论。我试过svg:
import matplotlib.pyplot as plt
# imbg is layout/ background
imbg = plt.imread(r"templates\stackflow\background.svg")
# imfg is furniture/ foreground
desk1200 = plt.imread(r"templates\stackflow\SPOT.svg")
# manually set aspect dimension for background
ext= [0,20,0,16]
desk1200_x= 1.2
desk1200_y= 1.85
fig, ax = plt.subplots()
ax.imshow(imbg, zorder= 0, extent=ext )
ax.imshow(desk1200, zorder= 1, extent=[5,5+desk1200_x,5,5+desk1200_y])
ax.axis(ext)
plt.xlabel("size", fontsize= 12)
plt.title('Proposed', fontsize= 20)
plt.show()
但得到了错误:
Traceback (most recent call last):
File "imageoverlay2.py", line 4, in <module>
imbg = plt.imread(r"templates\stackflow\background.svg")
File "\Python\Python36\site-packages\matplotlib\pyplot.py", line 2233, in imread
return _imread(*args, **kwargs)
File "\Python\Python36\site-packages\matplotlib\image.py", line 1280, in imread
im = pilread(fname)
File "\Python\Python36\site-packages\matplotlib\image.py", line 1258, in pilread
with Image.open(fname) as image:
File "\Python\Python36\site-packages\PIL\Image.py", line 2572, in open
% (filename if filename else fp))
OSError: cannot identify image file 'templates\\stackflow\\background.svg'