在for
循環中,我創建了可變數量的子圖,這些子圖顯示在一個圖上。我是否也可以將每個子圖保存爲單獨的全尺寸圖和圖像文件(最好是JPG)?Matlab將個別子圖保存爲jpg
3
A
回答
2
使用copyobj到一個新的人物,然後使用新數字手柄另存爲:
,你應該有提供示例代碼(見SSCCE):
figure
nLines = 2;
nColumns = 3;
handles = zeros(nLines,nColumns)
for line = 1:nLines
for column = 1:nColumns
handles(line,column)=subplot(nLines,nColumns,column+(line-1)*nColumns);
plot([line column]);
title(sprintf('Cool title (%d,%d)',line,column))
ylabel(sprintf('Ylabel yeah (%d,%d)',line,column))
xlabel(sprintf('Xlabel nah (%d,%d)',line,column))
end
end
在這裏,我的插曲句柄保存但假如你沒有他們保存:
axesH = findobj(gcf,'Type','axes','-not','Tag','legend'); % This will change the order from which the axes will be saved. If you need to save in the correct order, you will need access to the subplot handles
nAxes = numel(axesH)
newFig = figure;
for k=1:nAxes
newAxes=copyobj(axesH(k),newFig);
% Expand subplot to occupy the hole figure:
set(newAxes,'OuterPosition',[0 0 1 1]);
tightInset=get(newAxes,'TightInset');
set(newAxes,'Position',[tightInset(1:2) [1 1]-(tightInset(3:4)+tightInset(1:2))])
saveas(newFig,sprintf('axes_%d.jpg',k),'jpg');
delete(newAxes);
end
delete(newFig);
例一中軸線保存:
要刪除死區,我使用了可用的信息on this topic。
1
說你有句柄subfigure
的軸,ha
,您可以使用getframe
和frame2im
如下,
F = getframe(ha);
[im,map] = frame2im(F);
if isempty(map)
imwrite(im,'subframe.jpg');
else
imwrite(im,map,'subframe.jpg');
end
注意,這將節省軸究竟它是如何出現在屏幕上,因此請在保存前根據自己的喜好調整圖形大小。要儘可能多地使用數字地圖,請在MATLAB Central上試用subfigure_tight函數。
+0
謝謝chappjc。它像廣告一樣,不幸的是我的框架返回空的顏色映射。我會繼續研究它。我給了你一個有用的點擊。 – user1502755
+0
你的意思是顏色**欄**? – chappjc
相關問題
- 1. 在Matlab中保存GUI爲.jpg
- 2. 將JPanel保存爲.jpg/.png圖像
- 3. android將canvas保存爲jpg圖像
- 4. java將JPG保存爲PNG
- 5. 將DataURL保存爲jpg
- 6. 將pgm圖像轉換爲jpg Matlab
- 7. 將蒙太奇保存爲圖像matlab
- 8. 在Matlab中將繪圖保存爲PNG
- 9. 將文件保存爲jpg格式
- 10. 在silverlight中將writeablebitmap保存爲JPG
- 11. 如何將PIL.ImageTk.PhotoImage保存爲jpg
- 12. Android的保存視圖爲JPG或PNG
- 13. 將dygraph圖表保存爲本地硬盤上的jpg圖像
- 14. 如何將圖片從圖片庫保存爲jpg
- 15. 如何將原始方向的位圖保存爲JPG圖像?
- 16. 從一個目錄縮小.JPG圖像並保存爲另一個.JPG/.PNG
- 17. 如何將JPG圖像保存爲安卓手機與as3
- 18. 如何用GDI +將圖像保存爲BMP/PNG/JPG?
- 19. 如何使用cfimage將圖像保存爲漸進式jpg?
- 20. 將WPF InkCanvas保存爲JPG - 圖像被裁剪
- 21. 將保存爲BMP/JPG的SQL Server的PNG圖片
- 22. 將位圖文件保存爲jpg服務器
- 23. 在NetworkX中無法將圖保存爲jpg或png文件
- 24. 將JFrame保存爲圖像文件(.JPG,.PNG,.BMP等)
- 25. 在Matlab中將位圖圖像保存爲位圖圖像
- 26. 將jpg插入matlab圖形的背景?
- 27. Matlab保存圖片
- 28. 將多個地塊r保存爲獨立的jpg
- 29. 將畫布另存爲jpg
- 30. Matlab將圖保存到特定大小?
謝謝華納。我最終得到了一個獨立的副圖和色彩映射文件。我給了你一個綠色的勾號,告訴我如何列舉一個人物上的物體。我會繼續研究它。 – user1502755
@ user1502755我無法得知子圖和顏色表的問題。如果您從您正在使用的次要情節中提供SSCCE,以及如何重現您遇到的問題,我可以幫助您。 – Werner