Stevie Kvothe
Stevie Kvothe

Reputation: 11

Cannot change line color in MATLAB plot

No matter what I specify as the colors of my lines on this MATLAB plot, the resulting plot displays this automatic coloring:

enter image description here

here is the code I used:

figure 

plot(cumsum(sign([y_pred]).*tst_y)/std(sign([y_pred]).*tst_y), 'g')  
xlabel('Time'); 
ylabel('Cumulative Returns (%)');          
title('Neural Network Model Returns')
hold on 

plot(cumsum(tst_y)/std(tst_y),'r')

hold off

I have tried different methods of specifying the color and even attempted to edit line color in the graph editor. Any idea how I can make these lines different colors? I am using Matlab 2016a trial version

Upvotes: 1

Views: 774

Answers (1)

Skogsv
Skogsv

Reputation: 490

Neither I can replicate your issues. Perhaps the data in y_pred or tst_y is not a simple double-class (perhaps something specific to the neural network toolbox?) and therefore has a differently defined plot function in matlab.

Otherwise you should be able to try

figure 

pl=plot(cumsum(sign([y_pred]).*tst_y)/std(sign([y_pred]).*tst_y));
pl.Color='g';
xlabel('Time'); 
ylabel('Cumulative Returns (%)');          
title('Neural Network Model Returns')
hold on 

pl=plot(cumsum(tst_y)/std(tst_y));
pl.Color='r';

hold off

Upvotes: 0

Related Questions