Matlab动画图:轴值不可见

a64a0gku  于 2023-02-09  发布在  Matlab
关注(0)|答案(1)|浏览(227)

我试图创建一个视频从我的数据使用matlab动画线功能。代码工作正常,但我没有得到轴值在最终输出。有人能请帮助我。在这里我附上了我的代码。

clc
clear
close all
%%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

leftX=[0    -0.081205   -0.16242    -0.24363    -0.32485    -0.40606    -0.48727    -0.56849    -0.6497 -0.73091    -0.81213    -0.89334    -0.97455    -1.0558 -1.137  -1.2182 -1.2994 -1.3806 -1.4618 -1.543  -1.6243 -1.7055 -1.7867 -1.8679 -1.9491 -2.0303 -2.1115 -2.1928 -2.274  -2.3552 -2.4364 -2.5176 -2.5988 -2.68   -2.7612 -2.8425 -2.9237 -3.0049];  
leftY=[45.281   51.25   48.898  59.386  49.465  62.04   50.664  53.231  63.503  53.371  55.802  59.646  56.474  56.683  57.956  56.628  56.925  57.331  56.525  56.857  57.245  56.807  56.973  57.035  56.859  56.993  57.126  57.126  57.012  57.046  57.112  57.144  57.079  57.045  56.927  57.089  57.134  57.012];

rightX=[0.000   0.081   0.162   0.244   0.325   0.406   0.487   0.568   0.650   0.731   0.812   0.893   0.975   1.056   1.137   1.218   1.299   1.381   1.462   1.543   1.624   1.706   1.787   1.868   1.949   2.030   2.112   2.193   2.274   2.355   2.436   2.518   2.599   2.680   2.761   2.843   2.924   3.005];
rightY=[45.281  51.212  48.869  59.459  49.138  62.068  50.844  52.928  63.230  53.481  55.907  59.519  56.434  56.849  57.779  56.599  57.046  57.256  56.714  56.974  56.936  56.936  57.113  56.924  56.941  56.908  57.044  56.847  56.952  57.008  56.947  57.041  57.038  56.910  56.858  57.093  57.034  56.928];

%animate function
h=animatedline('Color','r','LineWidth',2.5);
axis([-2.0 2.0 40 70]);

h2=animatedline('LineWidth',2.5);
box on
set(gca, 'FontSize', 1.20, 'LineWidth', 1.2);
ylabel(' O^{2-}ion density(ion/{nm}^3)', 'FontSize', 20);
xlabel('Distance from GB core(nm)', 'FontSize', 20);

frames= cell(length(leftX)+20,1)

%define forloop

for i=1:length(leftX)
    addpoints(h,leftX(i),leftY(i));
    addpoints(h2,rightX(i),rightY(i))
    
       drawnow; pause(1.3)
       frame(i)=getframe(gcf);
end 

obj =VideoWriter('oscillations.avi');
obj.Quality=100;
obj.FrameRate =1;
open(obj);
for i=1:length(leftX)
    writeVideo(obj,frame(i));

end
obj.close()
wh6knrhe

wh6knrhe1#

只是因为你打电话给

set(gca, 'FontSize', 1.20, 'LineWidth', 1.2);

刻度标签在那里,但它们非常非常小。请尝试增加您强加的“字体大小”值,例如:

set(gca, 'FontSize', 5, 'LineWidth', 1.2);

相关问题