Squashed initial commit
This commit is contained in:
23
qhtcp-workflow/apps/matlab/ezview/Axes2FigPrint.m
Executable file
23
qhtcp-workflow/apps/matlab/ezview/Axes2FigPrint.m
Executable file
@@ -0,0 +1,23 @@
|
||||
close all
|
||||
figure('units','pix','pos',[200 200 850 750])
|
||||
ax=axes;
|
||||
plot((1:10).^2)
|
||||
set(ax,'units','pix')
|
||||
legend('x^2')
|
||||
xlabel('X Label','fontsize',12)
|
||||
ylabel('Y Label','fontsize',12)
|
||||
title('Title','fontsize',24)
|
||||
drawnow
|
||||
|
||||
% Now capture the axes and labels.
|
||||
P=get(ax,'pos');
|
||||
T=get(ax,'tightinset');
|
||||
h=[P(1)-T(1)-5 P(2)-T(2)-5 P(3)+P(1)/2+T(3)+15 P(4)+P(2)/2+T(4)+10];
|
||||
F=getframe(gcf,h);
|
||||
[X,Map]=frame2im(F);
|
||||
% I put the funny background color so the captured area stands out.
|
||||
figure('color',[.6 .2 .2],'units','pix','pos',[26 33 1184 925])
|
||||
image(X)
|
||||
set(gca,'visible','off')
|
||||
axis normal
|
||||
imwrite(X,'myimage.jpg') % save the image
|
||||
Reference in New Issue
Block a user