如何消除使用 'area' 函数的 MATLAB 图形中的一条奇怪的水平线?

how to eliminate a strange horizontal line in MATLAB figure that uses the 'area' function?

我正在尝试使用 area 函数在 MATLAB2015 中绘制填充高斯(表示库仑势中电子的波函数),但在其下方出现了一条不需要的水平线.对了,这行在MATLAB2011上没有出现,但是现在我没有MATLAB.

这个版本

我怎样才能去掉这条线?? - 请帮忙。

代码如下:

close all;clc
x1=-5:0.0001:-0.25;
x2=0.25:0.0001:5;
phi_C_1=-1./abs(x1);
phi_C_2=-1./abs(x2);

figure
plot(x1,phi_C_1,'.-k','MarkerSize',15,'LineWidth',5)
hold on
h_1=plot(x2,phi_C_2,'.-k','MarkerSize',15,'LineWidth',5);
ylim([-4 3])
xlim([-3 3])

x=-1:0.0001:1;

c1=11;c2=-2.7; 
y=0.5*exp(-c1*x.^2)+c2;
%axis off
set(gca,'visible','off')

hold on
%plot(x,y,'g.-','MarkerSize',15,'LineWidth',5)
h_2=area(x,y,c2,'FaceColor',[0 1 0],'LineStyle','none',...
    'AlignVertexCenters','off');
set(gca,'visible','off')

生成的图形是:

这是您要作为第三个输入传递给 area, which you have set as -2.7. Set the ShowBaseLine 属性 到 'off'area 对象的 BaseLine:

h_2 = area(x, y, c2, 'FaceColor', [0 1 0], 'LineStyle', 'none', ...
           'AlignVertexCenters', 'off', 'ShowBaseLine', 'off');