Colored plot of a parameter with coordinates not homogeneous

Goodmorning,
I have a txt file as follow:
X Y Parameter
1.1 0.5 324
1.2 0.7 4222
1.5 1.1 425
2 1.11 5
My file is bigger, but it's just an example. I would like to rapresent in a X,Y plot the value of "Parameter" with a colored scale. Since the interval between coordinates is not constant I don't know how to rapresent it. Can anyone help me?
Thank you!

답변 (1개)

Jonas Allgeier
Jonas Allgeier 2020년 3월 5일

1 개 추천

You can use textscan(), readtable() or importdata() to read the values into the workspace.
For plotting in different colors, scatter() would make sense.

댓글 수: 5

Thank you, but my problem is not import data, but how to build a plot since I don't have a matrix of values but a vector, where any value has two coordinate associated
Alright. For plotting scattered datapoints with different colors, you can use scatter(). See the following example.
scatter(rand(10,1),1:10,[],1:10,'filled')
If you want to fill the space in between the scattered points, you would need to perform some kind of interpolation.
"If you want to fill the space in between the scattered points, you would need to perform some kind of interpolation."
Yes, this is exactly what I need. Sorry I didn't explain it properly.
Then see this page for various 2D interpolation techniques.
Thank you!

댓글을 달려면 로그인하십시오.

카테고리

질문:

2020년 3월 5일

댓글:

2020년 3월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by