Borrar filtros
Borrar filtros

Creating subplot from saved semilog plots

2 visualizaciones (últimos 30 días)
Stephen Shank
Stephen Shank el 20 de Oct. de 2014
Comentada: Stephen Shank el 21 de Oct. de 2014
If I've saved plots that were generated by semilogy as files, how can I place them into a figure with subplots? Note that
does not work for figures generated by semilogy, though I do not really understand why, even after trying to read up on handle graphics.

Respuesta aceptada

Bruno Pop-Stefanov
Bruno Pop-Stefanov el 20 de Oct. de 2014
This is probably because the axes scale is linear by default.
Change the 'YScale' property from 'linear' to 'log' as follows:
h1 = openfig('test1.fig','reuse'); % open figure
ax1 = gca; % get handle to axes of figure
h2 = openfig('test2.fig','reuse');
ax2 = gca;
% test1.fig and test2.fig are the names of the figure files which you would
% like to copy into multiple subplots
h3 = figure; %create new figure
s1 = subplot(2,1,1); %create and get handle to the subplot axes
s2 = subplot(2,1,2);
fig1 = get(ax1,'children'); %get handle to all the children in the figure
fig2 = get(ax2,'children');
copyobj(fig1,s1); %copy children to new parent axes i.e. the subplot axes
copyobj(fig2,s2);
Add the following:
set(s1, 'YScale','log')
set(s2, 'YScale','log')
  1 comentario
Stephen Shank
Stephen Shank el 21 de Oct. de 2014
Worked like a charm... so simple! Thanks very much!

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by