フィルターのクリア

Combine two box plots and a line plot in one figure

22 ビュー (過去 30 日間)
Roy
Roy 2017 年 12 月 28 日
編集済み: DGM 2023 年 9 月 6 日
I have 3 data sets (x1,y1),(x2,y2),(x3,y3) each of them are 1D arrays of different sizes, e.g. (x1,y1) has 30 elements each, (x2,y2) has 40 and (x3,y3) has 50 elements each..I want to create boxplots for sets (x1,y1) and (x2,y2) and a line plot for (x3,y3) and plot all of them on a single figure with a common X and Y axis range. All values of x1,x2,x3 lie between (0.5 to 1.1) and y1,y2,y3 lie between (200 to 2000)..How do I do it?
  1 件のコメント
Rik
Rik 2017 年 12 月 28 日
Have you tried hold(ax,'on')?

サインインしてコメントする。

回答 (2 件)

Roy
Roy 2018 年 1 月 2 日
編集済み: Roy 2018 年 1 月 2 日
Happy New Year to all.. Rik..yes I have tried all possible variants of hold on..trying to draw the line plot first and then the box plot etc..but 1) not able to combine the line plot with at least one box plot or , 2) two box plots together..
To explain in a simpler way...here are the individual figures..(test_1,test_2,test_3)..All I want to do is combine them all in one plot with a common X and Y range..if merging all 3 is not possible priority would be at least the test_1 and test_3 together..
Thank you..Any suggestion is appreciated...

Lukas Öhlund
Lukas Öhlund 2023 年 9 月 6 日
編集済み: DGM 2023 年 9 月 6 日
All the x-vectors needs to be categorical. I have not tried creating two boxplots in the same graph, but I have combined a boxchart and line-plots.
What i do is:
figure()
boxchart(my_array_containing_data)
hold on
categorical_x_vect = categorical(my_real_x_vect);
plot(categorical_x_vect, my_y_data)
hold off
I know this is an old question, but maybe it helps someone.
Cheers!

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by