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!