MATLAB Answers

connect median in a boxplot

64 views (last 30 days)
yasmine ayed
yasmine ayed on 11 Sep 2019
Commented: Akira Agata on 20 Sep 2019
Hi,
I have this boxplot which reprent wind velocity according to time.
I want to connect all medians ( represented with an horizantal red line) with just one curve.
what can I do ?
wind velocity by time of bizert station.png

  0 Comments

Sign in to comment.

Accepted Answer

Akira Agata
Akira Agata on 11 Sep 2019
Like this?
% Sample data
Data = randn(100,10);
% Calculate median for each column
med = median(Data);
% Visualize the result
figure
boxplot(Data)
hold on
plot(med,'ro-')
boxplot.png

  3 Comments

the cyclist
the cyclist on 12 Sep 2019
If you don't have the original data, then you can get at the graphical object that is the median line using
h = findobj(gca,'Tag','Median');
[h.YData];
This will give duplicates of the value, because it is the y-coordinate of the endpoints of the line.
yasmine ayed
yasmine ayed on 12 Sep 2019
Thank you for your answer Every thing is clear I tried it and it works but the only thing that I want to know is about %sample data How can I enter my data that I work with because I dont know how you do the choice of randn(100,10) How can I put my x and y axies
Akira Agata
Akira Agata on 20 Sep 2019
It depends on what types of file your data is stored.
If your data is stored in CSV or Excel file format, it would be easy to import your data.
The following link would be some help.

Sign in to comment.

More Answers (0)

Sign in to answer this question.