필터 지우기
필터 지우기

How to remove axis from a figure?

조회 수: 1,450 (최근 30일)
Davide Magnelli
Davide Magnelli 2017년 11월 8일
댓글: Jagadeesh Korukonda 2022년 8월 22일
I have a script as follow:
if true
% Set up MOVIE object
vidObj = VideoWriter('Field_adv_diff_2D.avi');
vidObj.Quality = 100;
vidObj.FrameRate = 1;
open(vidObj);
set(gca,'nextplot','replacechildren');
% %%CONTOUR PLOT
% ZLevels = 288:1:300;
Naux = 200;
Minimum = min(min(node_state));
Maximum = max(max(node_state));
levels = Minimum:(max(max(node_state))-min(min(node_state)))/200:Maximum;
% k = 6000;
% Mesh = Mesh_simulator;
Xg = min(Mesh.xy(1,:)):(max(Mesh.xy(1,:))-min(Mesh.xy(1,:)))/Naux:max(Mesh.xy(1,:));
Yg = min(Mesh.xy(2,:)):(max(Mesh.xy(2,:))-min(Mesh.xy(2,:)))/Naux:max(Mesh.xy(2,:));
[XI,YI]=meshgrid(Xg,Yg);
ZI = zeros(length(XI),length(YI));
% for k = (time_sim/4):(time_sim/4):time_sim
for k = [source(4)+1 100:100:source(5)]
for ii=1:size(Mesh.ele,2)
xx = [Mesh.xy(1, Mesh.ele(1,ii)) Mesh.xy(1, Mesh.ele(2,ii)) Mesh.xy(1, Mesh.ele(3,ii))];
yy = [Mesh.xy(2, Mesh.ele(1,ii)) Mesh.xy(2, Mesh.ele(2,ii)) Mesh.xy(2, Mesh.ele(3,ii))];
IN = inpolygon(XI, YI, xx, yy);
% ZI(IN) = (node_state(Mesh.ele(2,ii),k) + node_state(Mesh.ele(3,ii),k) + node_state(Mesh.ele(4,ii),k)) / 3;
% oppure:
points = find(IN);
for i = 1:length(points)
N(i,:) = Get_shapeN_2D_DIFFUSION (Mesh,ii,[XI(points(i)) YI(points(i))]);
ZI(points(i)) = N(i,:)*[node_state(Mesh.ele(1,ii),k); node_state(Mesh.ele(2,ii),k); node_state(Mesh.ele(3,ii),k)];
end
end
figure;
contourf(XI,YI,ZI,levels,'LineStyle','none','LineColor',[0 0 0]);
% colorbar();
caxis([Minimum Maximum])
% colormap(jet)
colormap(gray)
map = colormap;
cmap = flipud(map);
colormap(cmap);
% hold on
% plot(sensor(1,:),sensor(2,:),'ow');
% hold off
title(sprintf('Field map at step %d %f sec)',k));
drawnow('expose');
axis equal;
currFrame = getframe(gcf);
writeVideo(vidObj,currFrame);
end
close(vidObj);
end
The figures are created with cartesian axis, I need to remove it because I should create a video with them.
Someone could help me?
Many thanks
  댓글 수: 2
Davide Magnelli
Davide Magnelli 2017년 11월 8일
The figures are created with cartesian axis, I need to remove it because I should create a video with them. Someone could help me?
Jagadeesh Korukonda
Jagadeesh Korukonda 2022년 8월 22일
set(gca,'XColor', 'none','YColor','none')
set(gca, 'color', 'none');

댓글을 달려면 로그인하십시오.

답변 (3개)

Sascha Power
Sascha Power 2021년 9월 28일
Just use the following command:
axis off
  댓글 수: 2
Petr Dohnalik
Petr Dohnalik 2022년 2월 15일
Similar problem. This works for me perfectly!
Larry Gulliver
Larry Gulliver 2022년 3월 18일
this answer made me laugh and worked perfect. Thank you.

댓글을 달려면 로그인하십시오.


Mariana Saenz
Mariana Saenz 2019년 7월 30일
편집: Mariana Saenz 2019년 7월 30일
set(gca,'XColor', 'none','YColor','none')
  댓글 수: 1
Majid
Majid 2021년 11월 13일
I like it! It removes the axis but not the blank white background!

댓글을 달려면 로그인하십시오.


M
M 2017년 11월 8일
set(gca,'visible','off')
  댓글 수: 2
Tijs Maas
Tijs Maas 2019년 5월 9일
Thanks! This removes the axis, but I still see ticks on the edges in 2019a! Acquisition_5.mat.png
M
M 2019년 5월 10일
Try this command:
set(gca,'xtick',[])

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Orange에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by