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!