Borrar filtros
Borrar filtros

Making a complex plot more efficient: is it possible to directly transform a subplot in a image?

2 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Walter Roberson
Walter Roberson el 30 de Mzo. de 2020
Editada: Walter Roberson el 30 de Mzo. de 2020
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 comentarios
Peter Bäuerle
Peter Bäuerle el 30 de Mzo. de 2020
How do I get rid of the white frame around the image by using saveas or print?
Peter Bäuerle
Peter Bäuerle el 30 de Mzo. de 2020
Found a simple solution to extend the plot over the whole figure:
set(gca,'position',[0 0 1 1],'units','normalized')

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by