필터 지우기
필터 지우기

histogram2 vs pcolor: on making the coloring of the former one smooth

조회 수: 2 (최근 30일)
Wouter
Wouter 2017년 7월 4일
댓글: Floris Jansen 2020년 2월 18일
When making a 2d graph using pcolor() or a surface plot with surf(), MATLAB evaluates the function on a grid and gives each piece of this grid a corresponding color. Adding
shading interp
makes the transitions between colors smooth, so that the grid is no longer visible.
It seems though, that this option does not work for a histogram2(), even though superficially such an object looks very similar.
Is there a way to make the output graphics object histogram2() smooth, with or without converting it into an ordinary figure?
  댓글 수: 5
Wouter
Wouter 2017년 7월 5일
편집: Wouter 2017년 7월 5일
Thanks again for your answer. I'm most interested in how the 'global shape' of the function compares in a glimp, so the resolution as such is as good as it needs to be for my purpose. The fact that one looks smooth and the other one pixelized makes it harder to compare.
Do you mean there is a class property of histogram2 containing the Z-values?
For now, playing with options as 'EdgeAlpha' and 'ShowEmptyBins' has already given me a more useful picture than the original one.
Floris Jansen
Floris Jansen 2020년 2월 18일
>> Do you mean there is a class property of histogram2 containing the Z-values?
Yes! The return value of histogram2 contains the values of the bins:
>> h = histogram2(1:5, 2:6);
>> h.Values
ans =
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
You can use these values with your favorite plotting tools to get exactly what you need.

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

답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by