Scatterhist function not allowing for boxplot on the y-axis to stay
3 次查看(过去 30 天)
显示 更早的评论
Hi I'm trying to run a scatterhistogram (scatterhist()) but whenever I run the function the figure will pop up with the boxplot correctly displayed for a brief second on the y-axis and then disappear immediately. I'm not sure why. I also want to be able to color in the points and I'm not sure how to do that. Any help will be appreciated.
k = scatterhist(swine2, ready.rr_la, 'Group', swine);
hold on;
j = get(k(1),'colororder');
boxplot(k(3),ready.rr_la,swine2, 'Labels', {'10','11', '12', '13'}, 'color', j);
view(k(2),[270,90]);
xlabel('Subject');
ylabel('Err_la');
The figure displayed is atttached
5 个评论
Adam Danz
2020-10-23
That's helpful but it's not a "MWE" (something we can copy-paste and run on our end to reproduce the problem).
It looks like you're not specifying the axes. I'll add an answer but if it doesn't solve the problem you'll need to give a MWE.
回答(1 个)
Adam Danz
2020-10-23
编辑:Adam Danz
2020-12-17
It looks like you're trying to add a boxplot to the y-historgram axes. Recall that the y-histogram in scatterhist is reversed. Also, you're rotating the scatter axes so that x and y are switched but the histograms aren't switched. Why not just switch x and y in the scatterhist function?
h = scatterhist(y,x,___);
To add a boxplot to the y-histogram axis,
hold(h(3), 'on')
boxplot(h(3), ___)
Use h(2) for the x-histogram or h(1) for the scatter axes.
4 个评论
Adam Danz
2020-10-27
I don't understand how your boxplots are supposed to map onto the histograms. But their x & y values need to be within range of the histogram's x & y values.
That will be very hard to do.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!