How to make graphic get the same color as the colorbar?
2 次查看(过去 30 天)
显示 更早的评论
I'm using this command:
>> datl=importdata('D:\Testes\testes_feitos\poisson_numerico.txt');
>> x=datl(:,1);
>> y=datl(:,2);
>> z=datl(:,3);
>> plot3(x,y,z);
>> colorbar
>> grid on
And it gives me this:
How can I make the graphic and the colorbar interact?
1 个评论
Scott MacKenzie
2021-6-22
One way is to use mesh instead of plot3. Do so and the mesh colors will be linked to the colorbar
采纳的回答
Scott MacKenzie
2021-6-22
I think this achieves what you are after. Use mesh, instead of plot3, and the mesh colors will be linked to the colorbar:
% your x, y, and z data
datl = rand(10,3);
x = datl(:,1);
y = datl(:,2);
z = datl(:,3);
F = scatteredInterpolant(x, y, z);
xx = linspace(min(x), max(x));
yy = linspace(min(y), max(y));
[XX, YY] = meshgrid(xx, yy);
ZZ = F(XX, YY);
mesh(XX, YY, ZZ, 'facecolor', 'none');
colorbar;
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colormaps 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!