plotly_matlab icon indicating copy to clipboard operation
plotly_matlab copied to clipboard

scatterhist not working

Open danton267 opened this issue 5 years ago • 0 comments

None of these work properly, first 3 examples only plot scatter plot and not the histogram, the last 2 examples yield an error. reference: https://uk.mathworks.com/help/stats/scatterhist.html

load fisheriris.mat;
x = meas(:,1);
y = meas(:,2);

scatterhist(x,y);
load fisheriris.mat;
x = meas(:,1);
y = meas(:,2);
scatterhist(x,y,'Group',species,'Kernel','on');
load fisheriris.mat;
x = meas(:,1);
y = meas(:,2);
scatterhist(x,y,'Group',species,'Kernel','on','Location','SouthEast',...
    'Direction','out','Color','kbr','LineStyle',{'-','-.',':'},...
    'LineWidth',[2,2,2],'Marker','+od','MarkerSize',[4,5,6]);
load fisheriris.mat;
x = meas(:,1);
y = meas(:,2);

h = scatterhist(x,y,'Group',species);
hold on;
clr = get(h(1),'colororder');
boxplot(h(2),x,species,'orientation','horizontal',...
     'label',{'','',''},'color',clr);
boxplot(h(3),y,species,'orientation','horizontal',...
     'label', {'','',''},'color',clr);
set(h(2:3),'XTickLabel','');
view(h(3),[270,90]);  % Rotate the Y plot
axis(h(1),'auto');  % Sync axes
hold off;
load fisheriris
x = meas(:,1);
y = meas(:,2);
figure
hp1 = uipanel('position',[0 .5 1 .5]);
hp2 = uipanel('position',[0 0 1 .5]);
scatterhist(x,y,'Group',species,'Kernel','on','Parent',hp1);
axes('Parent',hp2);
hist(x);

After it is fixed, please reply with links to chart studio plots, so I can include them in the online documents.

danton267 avatar Sep 20 '21 00:09 danton267