我正在尝试制作这样的图形。绘图矩阵,每个都是数值矩阵的可视化。
我认为代码应该如下所示:
使用 PyPlot
figure()
for i in 1:100
subplot(10, 10, i)
matshow(rand(10, 10))
end
但是这些图将独立地在新窗口中弹出,而不是在同一图形的不同部分中弹出。我做错了什么?
预先感谢您的宝贵时间!
最佳答案
免责声明:我对 Julia 毫无经验。因此,可能存在一些我不知道的警告。
matplotlib.pyplot.matshow(A, fignum=None, **kw)
Display an array as a matrix in a new figure window. [...]
fignum:
[ None | integer | False ]
By default, matshow() creates a new figure window with automatic numbering. If fignum is given as an integer, the created figure will use this figure number. Because of how matshow() tries to set the figure aspect ratio to be the one of the array, if you provide the number of an already existing figure, strange things may happen. Iffignum
is False or 0, a new figure window will NOT be created.
因此,两种可能的选择可能是:
使用
fignum=false
figure() for i in 1:100 subplot(10, 10, i) matshow(rand(10, 10), fignum=false) end
使用
imshow
而不是matshow
(因为imshow
默认情况下不会创建新图形)figure() for i in 1:100 subplot(10, 10, i) imshow(rand(10, 10)) end
关于matplotlib - 如何将多个 matshow() 结果放在一张图中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46333342/