3D Box Plotting
9 次查看(过去 30 天)
显示 更早的评论
I'm trying to plot a few boxes in 3D, my axes are time, frequency, and power. So far I have this:
freqs = 50:10:500;
times = linspace(0,10, length(freqs));
[X,Y] = meshgrid(freqs, times);
Z = zeros(size(X));
Z(5:10, 5:10) = 1; % signal 1
Z(5:35, 30:35) = 1; % signal 2
surf(X,Y,Z);
So far signals are only colored red at the peak of each one. Everywhere else, including the ascent, is blue. How can I make the ascent red. Also is possible to make them a different color?
0 个评论
回答(2 个)
Andrew Newell
2011-4-24
For red color, use
colormap([1 0 0])
If by making them a different color you mean the whole plot, you could substitute [0 1 0] for green, etc. (see Colorspec).
0 个评论
Matt Fig
2011-4-24
I don't know what you mean by "the ascent." But you could look around at the properties of the surface object and see if setting them to different colors gives what you want...
S = surf(X,Y,Z);
get(S) % List the properties, use SET to set the properties...
Also, you might consider using patch objects instead, depending on what you are trying to do with your boxes. See this file for example...
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Color and Styling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!