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!