필터 지우기
필터 지우기

How do I create a color bar to correspond to my jet color scheme?

조회 수: 73 (최근 30일)
I've used the jet function to create a gradient of color, such that every color is a different voltage. How do I make a color bar given the RGB array I made with the jet function and assign the max and min voltage values on the color bar for my figure? Thanks!

채택된 답변

Chad Greene
Chad Greene 2018년 11월 13일
편집: Chad Greene 2018년 11월 13일
Try this:
Plot some data:
surf(peaks)
Change the colormap*:
colormap(jet)
Add a colorbar and put a label on it:
cb = colorbar;
ylabel(cb,'voltage')
Set colorbar limits:
caxis([-8 4])
That'll create this figure:
* But note, there are some perceptual issues with using jet to represent numbers. For those reason's the jet colormap has fallen out of fashion in recent years. Read up on #endrainbow if you're curious to know more.
  댓글 수: 4
Steven Lord
Steven Lord 2018년 11월 13일
Please create a small synthetic dataset (say ten to twenty points) that is similar to your actual data and show the code you use to create your scatter plot using that synthetic dataset. After that describe specifically how the figure created by that code differs in appearance from the code you want. Perhaps with a concrete example we can run and use to experiment we can offer a suggestion on how to achieve or approach your goal.
Alexandria Will-Cole
Alexandria Will-Cole 2018년 11월 14일
This worked finally! Thank you!

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

추가 답변 (1개)

Image Analyst
Image Analyst 2018년 11월 13일
Use the caxis() function.

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by