Plotting points on a 2D filled contour?

조회 수: 50 (최근 30일)
Max Di Luigi
Max Di Luigi 2018년 11월 9일
답변: jonas 2018년 11월 9일
I have stored some points (each point formed of two components - x1 & x2 variables) generated from iterations (while loop) in a matrix. How do I plot a particular element (x1i & x2i of a stored point for instance) of that matrix as a point on a 2D filled contour? I do not need to plot all the points, but only a few. Thanks for your help.

답변 (1개)

jonas
jonas 2018년 11월 9일
Not sure I understand the question, but you should be able to do that easily by using contourf and scatter.
For example, let's say you have some xy data (n x 2) and you want to plot certain points on a contourf:
n = 100; n points
ind = [20,40,60,94]; %points to plot
xy = randi([10 20],n,2)
contourf(peaks);hold on
scatter(xy(ind,1),xy(ind,2),[],'k')

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by