How can you nicely format box plots spread unevenly across the x axis?
조회 수: 3 (최근 30일)
이전 댓글 표시
Can anyone help me format this plot of several box plots in a more aesthetically pleasing way? What is going on near the origin is rather unclear. Also it has made the width of the later boxplots very thin, I have not been able to correct this.
I have attached the data points I am plotting, this graph was created using the following code
figure
boxplot(M,'positions',KD_values)
댓글 수: 0
채택된 답변
Cam Salzberger
2015년 9월 4일
Hello Laurence,
I understand that you would like the box plot to be a little more easily viewed, both in box width and box spacing.
The former issue can be resolved by specifying the 'widths' argument in the boxplot function. Since there is a different amount of spacing between each line, it is probably best to specify the box widths differently for each data point based on that spacing (so long as it is understood that box width is not representing data differently).
The latter issue can be resolved by viewing the plot with a logarithmic scale on the x-axis. This will space out the data points more evenly, though there is now a little clustering in the higher valued regions.
KDgaps = diff(KD_values)/2;
boxplot(M,'positions',KD_values,'widths',[KDgaps(1) KDgaps])
set(gca,'XScale','log')
I hope this helps!
-Cam
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!