Making a complex plot more efficient: is it possible to directly transform a subplot in a image?
2 ビュー (過去 30 日間)
古いコメントを表示
Dear Matlab Community,
I have a plot with several subplot and different gui elements, some of them are initially hidden (depending on the user inputs). Well, this gui is rather slow. However, the user only has to interact with two of them and the other (likes a big surface plot) is static. Thus, I saved those static plots to png-images and import than as image to the gui, which accelerates the performance a lot.
So far I use a code like that
fig = figure( 'visible', 'off'); % plot in a separate figure to export the image
% my plotting options
tempF= getframe(fig); % save the image without white frame
img = tempF.cdata; % save the image without white frame
imwrite(img, 'tempFile.png'); % save the image without white frame
delete(fig); % delete the separate figure
TargetPlot=subplot('position',[0.05, 0.06, 0.8, 0.2]);
TargetPlot=image( imread('tempFile.png') ); % import the image
I’m wondering if there is a way instead of plotting (exportgraphics is not part of my version) the figure to directly transform it to an image?
All ideas to optimize that are welcome.
Thanks,
Peter
0 件のコメント
採用された回答
Walter Roberson
2020 年 3 月 30 日
編集済み: Walter Roberson
2020 年 3 月 30 日
I’m wondering if there is a way instead of plotting (exportgraphics is not part of my version) the figure to directly transform it to an image?
No. Before R2020a, all of the supported ways of exporting graphics involve using the rendering engine to create images of the plot -- though exporting to PDF could at least separate out the text.
Before R2020a, none of the supported ways of exporting graphics supported exporting as vector or as Microsoft meta-graphics. The closest to that is that the File Exchange contribution export_fig supports saving to svg . (Though possibly print() supported rendering to clipboard, I would have to recheck that point.)
As of R2020a, copygraphics() supports saving to clipboard, and exportgraphics supports writing to pdf in vector form.
4 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Printing and Saving についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!