为什么我的情节中的点被一个框包围?

Why are points in my plot surrounded by a box?

我有以下脚本:

clear; clc
close all

# input samples
samples = rand(100,2);

# gaussian mean and covariance
mu = mean(samples);
sigma = cov(samples);

# define a 2D grid
x1 = -3:.2:3;
x2 = -3:.2:3;
[X1,X2] = meshgrid(x1,x2);
X = [X1(:) X2(:)];

# evaluate the pdf at the grid points
y = mvnpdf(X,mu,sigma);
y = reshape(y,length(x2),length(x1));

# plot iso-contours
contour(x1,x2,y,[0.0001 0.001 0.01 0.05 0.15 0.25 0.35])
xlabel('x')
ylabel('y')
line([0 0 1 1 0],[1 0 0 1 1],'Linestyle','--','Color','k')

# plot samples
hold on
plot(samples(:,1),samples(:,2),'+')

如果我 运行 它,这是我得到的输出:

除了绘制的点由一个框勾勒出轮廓之外,这基本上很好。出于美学原因,我想删除那个盒子。

拜托,有人可以告诉我该怎么做吗?

不是答案(因为评论中已经回答了),但是因为很难将代码放在评论中,所以将其写为答案。

我只是想说,既然你提到了 'aesthetics',你通常可以用最少的额外努力使你的图表呈现有很大的不同。例如

clear; clc; clf
figure(1)

# input samples
samples = rand(100,2);

# gaussian mean and covariance
mu = mean(samples);
sigma = cov(samples);

# define a 2D grid
x1 = -3:.2:3;
x2 = -3:.2:3;
[X1,X2] = meshgrid(x1,x2);
X = [X1(:) X2(:)];

# evaluate the pdf at the grid points
y = mvnpdf(X,mu,sigma);
y = reshape(y,length(x2),length(x1));

# plot iso-contours
contour(x1,x2,y,[0.0001 0.001 0.01 0.05 0.15 0.25 0.35], 'linewidth', 3);
set(gcf, 'color', [0.75,0.75,0.75]);
set(gca, 'color', 'k');
xlabel('x')
ylabel('y')

# plot samples
hold on
h = plot(samples(:,1),samples(:,2), 'o', 'markerfacecolor', [0, 0.6, 1], ...
         'markeredgecolor', [0, .4, .8], 'linewidth', 1.5, 'markersize', 7);
axis tight auto equal square;