Plotting a matrix of vector to the index with different makers for all vectors
12 次查看(过去 30 天)
显示 更早的评论
Hi MATLAB,
I am trying to plot all 10 vectors in Matrix X (10,51) with the index (range 1:51) on the X axis and the values for all 10 vectors on the Y axis.
I use this code: plot(X'),
I am trying to make the plot also clear in black and white but that has not succeeded yet. I understand there are only 4 types of line styles so I think I should work with markers. The goals is thus to have different markers for all 10 vectors and only showing them every 5 iterations/index (so on x axis = 5,10,15,20.....). Is there a way to do that in a clear way, without splitting the matrix in 10 different vectors and combining the plots (takes alot of time and I have many matrices with all different dimensions). A problem is that if I do split it in different vectors I also need to add [1:51] to all these vectors so that the plot function understand that I want the index on the x axis.
Thank you for your time,
Oscar
0 个评论
采纳的回答
Ritvik Garg
2021-6-15
Hi Oscar,
Here’s an example of plotting a matrix with 5 different markers for 5 vectors each of length 20, marking at every 5th iteration.
a = rand(5,20);
p = plot(a');
set(p, {"Marker"}, {'+';'o';'*';'x';'v';}, 'MarkerIndices', 5:5:20);
legend;
Hope this helps.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!