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!