how to create a scatter plot and add contourlines for a specific level

2 次查看(过去 30 天)
I have to create a scatter plot from a copulapdf command and adding contourlines for the level [0.1:0.1:0.9]. I wrote this script to make a contour but i'm not able to specify the level. Which part of this script i have to modify and how?
rho = 0.5;
n= 1000;
s3 = copularnd('Frank',rho,n);
figure
scatterhist(s3(:,1),s3(:,2))
hold on
[n,c] = hist3([s3(:,1),s3(:,2)]);
contour(c{1},c{2},n)

回答(1 个)

jonas
jonas 2018-8-30
编辑:jonas 2018-8-30
The argument, which can be found in the doc , is called 'levellist'
contour(c{1},c{2},'levellist',[1 5 10])
sets the levels to z=[1 5 10]
  2 个评论
EM geo
EM geo 2018-8-30
thank you for the reply! This is the code corrected with your suggestion:
rho = 0.5;
n= 1000;
s3 = copularnd('Frank',rho,n);
figure
scatterhist(s3(:,1),s3(:,2))
hold on
[n,c] = hist3([s3(:,1),s3(:,2)]);
contour(c{1},c{2},'levellist',[0.1 0.1 0.9])
Matlab gives me this error:
"Warning: Error occurred while evaluating listener callback."
jonas
jonas 2018-8-30
编辑:jonas 2018-8-30
Weird, what MATLAB release are you running?
Do you get the same error if you try the following minimal example?
contour(peaks,'levellist',[0.1 0.1 0.9])

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by