Creating plot over the Box plot
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Minha Ferouz
il 19 Giu 2018
Modificato: Minha Ferouz
il 20 Giu 2018
Hi Friends,
A = 4; B = 6; C = 8; D = 9;
values = [A;B;C;D]
Y = [500];
labels = {'a','b','c','d','e'}
figure
hold on
boxplot(values,Y);
plot(Y,values,'r*')
I'm trying to use hold on to view plot (*) on the boxplot. But, it doesn't work well and I only see box plot not the plot over it.
Thanks
0 Commenti
Risposta accettata
Jeffrey Eymer
il 19 Giu 2018
You are misunderstanding how the arguments to boxplot are used. boxplot(values, [500]) does not actually move the box plot to the x-value of 500, rather it just labels the box plot with an x-value of 500. The box plot itself still resides at x=1.
To accomplish what you are trying to do, replace the line with
boxplot(values, Y, 'positions', Y);
The 'positions' argument designates where the box plot will actually be placed on the graph.
2 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!