how to color a surface?

Evrytime i try to color a surface the entire plot comes out to be pitch black in color. i tried these codes..please temme if they r right or wrong.
figure(6)
colormap hsv
surf(ti,X,P_s)
colorbar
ylabel('Distance along pipeline (m)')
xlabel('time (hours)')
zlabel('Pressure (bar)')
grid on
plzz help!

댓글 수: 10

Image Analyst
Image Analyst 2013년 8월 25일
I see you using the colormap function - doesn't that color it?
roro6992
roro6992 2013년 8월 25일
NO thts d problem...i cant undastnd y its not coloring the plot. the whole plot turns out to be pitch black evry time i execute the code.
Walter Roberson
Walter Roberson 2013년 8월 25일
편집: Walter Roberson 2013년 8월 25일
What are max() and min() of P_s(:) ?
Does the problem still occur if you do not have "grid on" ?
roro6992
roro6992 2013년 8월 25일
P_s max is 50 and minn is 38..its a plot of pressure vs time and distance. Matrices are of correct dimensions. the surf command is getting executed. but m not getting any colored plot. its a black surface on which no variations of preesure cud be understood. Its still occurin evn wen the grid is off.
Walter Roberson
Walter Roberson 2013년 8월 25일
To check: do you get a colored plot if you do not use "colormap hsv" ?
roro6992
roro6992 2013년 8월 25일
NO...m no way getting a colored plot..evn wen m using colormap hot or colormap gray..or copper
roro6992
roro6992 2013년 8월 25일
But the colorbar is showing all the colors n corresponding values!
Odd... I don't know. A couple of more experiments:
1)
opengl software
This would be to workaround some drawing bugs
2)
surf(ti,X,double(P_s))
This is complete speculation on my part as to what the cause might be.
roro6992
roro6992 2013년 8월 25일
편집: roro6992 2013년 8월 25일
When n where to use the opengl software command.?? Anyway thnx for helping man.
Walter Roberson
Walter Roberson 2013년 8월 25일
The "opengl" command could be used at any point.

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

답변 (1개)

Youssef  Khmou
Youssef Khmou 2013년 8월 26일

0 개 추천

I think your data have many isosamples, that makes the colormap concentrated because of the interpolation,add this command before using colormap :
shading interp

카테고리

질문:

2013년 8월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by