필터 지우기
필터 지우기

BAR: Stacking identical data

조회 수: 1 (최근 30일)
mathworks2011
mathworks2011 2011년 9월 10일
c = NaN(2,5);
c(1,:) = rand(1,5);
c(2,:) = randi(10,1,5);
c = sort(c,2);
bar(c(1,:), c(2,:), 'r',);
Here c is "fake" data to make it easier to understand.
Gives: "XData cannot contain duplicate values"
This is because I have two values the same e.g c(1,1) = c(1,2) AND c(2,1) = c(2,2).
However, I do wish to plot the second set of identical values, but as a bar on TOP OF the existing bar at that given value. Perhaps seperated by a space or perhaps by a thin black line. Any ideas on how I can do this? Thus showing there is a seperate set of data at this location on the x-axis.
I do not want to merge the data sets, as the fact they are seperate means something.
many thanks

답변 (1개)

bym
bym 2011년 9월 10일
using your 'fake' data try:
bar(c','stack')
  댓글 수: 1
mathworks2011
mathworks2011 2011년 9월 12일
As above. Displays one bar for each row. Does NOT allow duplicate values.

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by