Help with plotspread plot
이전 댓글 표시
Hi there, I have 3 groups of data A,B, and C and I want to plot A and B under the same category with different colors/markers. I want to use the plotspread function. How do I do that?
댓글 수: 5
Walter Roberson
2019년 9월 4일
Chi Pham
2019년 9월 4일
Walter Roberson
2019년 9월 4일
According to the documentation at the beginning of the function:
% distributionColors : color identifier (string, cell array of
% strings), or colormap, with a single color, or one color per
% distribution (or per entry in distributionIdx). Colors the
% distributions. Default: 'b'
% distributionMarkers : string, or cell array of strings, with either
% a single marker or one marker per distribution (or per entry in
% distributionIdx). See linespec for admissible markers.
% Default: '.'
So you can provide color and marker information for each distribution, using the same color or different color, same marker or different marker, according to your needs.
Chi Pham
2019년 9월 5일
Walter Roberson
2019년 9월 5일
Ah, A and B are to be plotted overlapping each other? I don't think the code can handle that.
답변 (1개)
Chris Angeloni
2021년 5월 5일
This is kind of a hack, as plotSpread.m doesn't like when the xValues for each category are not increasing, so I just defined the first two categories to be very close together, then adjust the xticks after:
a = randn(50,1); b = randn(50,1)+1; c = randn(50,1)+2;
plotSpread([a,b,c],'xValues',[1 1.0001 2],'distributionColors',{'r','g','b'})
set(gca,'xtick',[1 2])
카테고리
도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!