How to plot density of binary data

조회 수: 4 (최근 30일)
Ryan
Ryan 2014년 2월 28일
댓글: dpb 2014년 3월 3일
I'm trying to plot either a 3D histogram, or a 2D plot with density (i.e. frequency) represented by color.
I used the hist3 command to create a density/frequency matrix (size 64x75). This matrix is created using the command: "cnt=hist3(X, [64 75])" and is calculated from raw data. My problem now is that I've created 70 matrices, representing the individual data from 70 research participants. I've averaged the density matrices across all participants, so I now have a 64x75 "average density matrix" that I need to plot. I've tried using the surf command, but I don't want a surface plot. I need bars to represent the information.
Is there a way to create either a 3D histogram, or a 2D plot with density represented by color, using the "average density matrix" that I have created? I've attached the average density matrix I'm trying to graph.
Thank you.
  댓글 수: 1
dpb
dpb 2014년 2월 28일
Wouldn't that be bar3?

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

답변 (2개)

Image Analyst
Image Analyst 2014년 2월 28일
Why not just display as a color image? Does it absolutely have to be a 2.5D perspective rendering of rising square bars (like a bird's eye view of downtown)?
  댓글 수: 4
Ryan
Ryan 2014년 3월 3일
bar3 plots zeros, which obscures the truth because when you see color, you assume that the event of interest (movement) occurred. In reality, no movement occurred, therefore there should be no color. You can see that this is the case in the "bar3" figure, which I've attached.
I would like the data in the figure to look more like the data in the "hist3" figure I've attached. Keep in mind that hist3 creates a figure from raw data, whereas I'm trying to create a 3D histogram from the density matrix, which works for surf but not for hist3. I've uploaded a density matrix file to facilitate understanding the data I'm trying to plot.
Thank you.
dpb
dpb 2014년 3월 3일
So can't you just change the 0-value locations to have white color?

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


Youssef  Khmou
Youssef Khmou 2014년 3월 1일
Ryan, as you need an alternative to two dimensional graphic like @image analyst proposed, you can use bar3 command, here is an example :
bar(magic(15))
  댓글 수: 1
Ryan
Ryan 2014년 3월 3일
I have tried using the bar3 command. The problem with bar3 is that the code plots zeros, and I can't figure out how to omit plotting zeros. I've tried changing zeros to "nan." If using the surf command, changing zeros to "nan" works keeps the function from plotting zeros. This is not the case with bar3. Zeros are plotted, even though they've been changed to NAN.

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

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by