color plotting error appearing only after one line and not appearing earlier
조회 수: 4 (최근 30일)
이전 댓글 표시
The second line of the fragment of code below throws an error. Does anyone have any idea why? I was able to plot just fine yesterday so I'm not sure what could be going on
plot(sulpholane9a(end-1000:20:end,1)*10^-6, sulpholane9a(end-1000:20:end,3)*10^9, '>','Color','b', 'LineWidth',1)%c(35,:))
hold on
plot(nitromethane11a(end-1000:20:end,1)*10^-6, nitromethane11a(end-1000:20:end,3)*10^9,'+','Color',c(45,:),'LineWidth',1)
hold on
plot(water2a(end-1000:20:end,1)*10^-6, water2a(end-1000:20:end,3)*10^9,'square','Color',c(65,:),'LineWidth',1)
Error using plot
Invalid RGB triplet. Specify a three-element vector of values between 0 and 1.
댓글 수: 1
Dyuman Joshi
2023년 8월 18일
What is the range of the values in and size of the array c?
As the error states, the values must be a 3 element vector with values between 0 and 1.
답변 (1개)
Shuba Nandini
2023년 8월 29일
Hello,
I understand you are getting color plotting error in your code using variable ‘c’.
The error message you're seeing "Invalid RGB triplet. Specify a three-element vector of values ranging from 0 and1" suggests that there might be a problem with how you specified the color in one of your plot commands.
- If you prefer to use predefined MATLAB colors, you can simply use color names such, as 'b', 'r', 'g' without specifying the RGB values as you have specified it in this plot command.
plot(sulpholane9a(end-1000:20:end,1)*10^-6, sulpholane9a(end-1000:20:end,3)*10^9, '>','Color','b', 'LineWidth',1)
You can also refer to the follwoing thread to know how this error is resolved:
I hope this helps!
Regards,
Shuba Nandini
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!