Enlarge figure in MATLAB

2 次查看(过去 30 天)
Kelvin
Kelvin 2015-10-22
编辑: Kelvin 2015-10-23
I want to create figure that is enlarged, I use:
fig = figure(1);
set (fig, 'Units', 'normalized', 'Position', [0,0,1,1]);
The dialogue is enlarged. What should I do if I also want the graph inside this dialogue also enlarged? Although I can use "zoom in" and "pan" in the dialogue to enlarge and reposition my graph I want this be done automatically by codes.
Update of my question:
I am trying to plot 3D block which the value is represented by color of each small unit block: clear; close all; clc;
fig = figure(1);
set (fig, 'Units', 'normalized', 'Position', [0,0,1,1]);
fig_color='w'; fig_colordef='white';
cMap=jet(256); %set the colomap using the "jet" scale
faceAlpha1=1;
faceAlpha2=0.65;
edgeColor1='none';
edgeColor2='none';
NumBoxX=100;%box number in x direction
NumBoxY=100;%box number in y direction
NumBoxZ=5;%box number in z direction
fid = fopen('Stress.dat','r');
datacell = textscan(fid, '%f%f%f%f%f%f%f%f%f%f%f%f%f%f');
fclose(fid);
all_data = cell2mat(datacell);
M=zeros(NumBoxX,NumBoxY,NumBoxZ);
for i=1:NumBoxX for j=1:NumBoxY for k=1:NumBoxZ num=k+NumBoxZ*(j-1)+NumBoxZ*NumBoxY*(i-1); M(i,j,k)=all_data(num,4); %the forth column of all_data is dislocation density end end end
indPatch=1:numel(M);
[F,V,C]=ind2patch(indPatch,M,'v'); %Call the function ind2patch in order to plot 3D cube with color
title('\sigma_{xy}','fontsize',20);
xlabel('y','fontsize',20);ylabel('x','fontsize',20);
zlabel('z','fontsize',20); hold on;
patch('Faces',F,'Vertices',V,'FaceColor','flat','CData',C,'EdgeColor','k','FaceAlpha',0.5);
axis equal; view(3); axis tight; axis vis3d; grid off;
colormap(cMap); caxis([min(M(:)) max(M(:))]);
cb = colorbar;
set(get(cb,'title'),'string','Stress (MPa)','fontsize',20);
lbpos = get(cb,'title'); % get the handle of the colorbar title
set(lbpos,'units','normalized','position',[0,1.04]);
zoom(1.9);
  3 个评论
Kelvin
Kelvin 2015-10-23
actually it is not a 2D plot, I used a function called ind2patch to make a 3D block which contains a number of smaller blocks in 3 dimensions. When I use xlims I just found that the x axis is extend but the figure is not enlarged.
Kelvin
Kelvin 2015-10-23
I updated my question above by adding my codes.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Exploration 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by