How to delete the lines between data points in colormap

3 ビュー (過去 30 日間)
Yachao Chen
Yachao Chen 2017 年 11 月 6 日
コメント済み: Walter Roberson 2017 年 11 月 7 日
I have been facing this problem that when I do colormap, there are always lines between my data points. I don't know how to efficiently let them gone. I have tried "shading interp' and 'linestyle','none', but none of them work. I have my figure looks like down below, and my code is like:
custom_colormap = [
0 0 1 ; ... %// blue
0 1 0 ; ... %// green
1 1 0 ; ... %// yellow
1 .5 0 ; ... %// orange
1 0 0 ; ... %// red
] ;
figure(1);
box on;
xx=[Sc_frac Sc_frac];
yy=[B_frac B_frac];
zz=zeros(size(xx));
cc=[correctM correctM];
hs=surf(xx,yy,zz,cc,'EdgeColor','interp','FaceColor','none','Marker','.');
hold on;
xx=[Sc_frac Sc_frac];
yy=[B_frac B_frac];
zz=zeros(size(xx));
cc=[correctM correctM];
hs=surf(xx,yy,zz,cc,'EdgeColor','interp','FaceColor','none','Marker','.','MarkerSize',30,'LineStyle','none');
  2 件のコメント
Walter Roberson
Walter Roberson 2017 年 11 月 6 日
編集済み: Walter Roberson 2017 年 11 月 6 日
Your variable custom_colormap is not used after it is defined, and your code does not appear to create a colorbar.
Yachao Chen
Yachao Chen 2017 年 11 月 6 日
Actually I don't want a "map", since that won't represent my data correctly. I'd like to have just the data points that using the color to represent the values. I figured this is a way to do it, but I don't know how to get rid of those lines. Do you also have idea about how to write a more proper code based on my requirements?

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2017 年 11 月 6 日
I see two possibilities:
1) that the lines you refer to are the black lines between elements of the colorbar on the right hand side, which the code you presented does not create; or
2) that the lines you refer to are the connecting lines between the points. If you do not want them then you should probably be using scatter() instead of surf(). If there is some good reason to use surf then your EdgeColor should be 'none' instead of 'interp'
  3 件のコメント
Yachao Chen
Yachao Chen 2017 年 11 月 6 日
OK, realized that there is one more place that did not correct. It works now. Thank you so much!
Walter Roberson
Walter Roberson 2017 年 11 月 7 日
You probably do not need the zz as you appear to be doing a 2D scatter. It wouldn't really hurt to use the zz with a scatter3(): with constant z, the difference is that the scatter3 version could be rotated off-plane which could matter if you were plotting multiple objects in the same axes.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeColor and Styling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by