Problem with color plotting 2d array in a multiple y plot of axes with a 1d array
Show older comments
So I have to plot a yyplot in an axes. There are 3 arrays one for time called BatteryNewTimeSection, one for CellVoltages called allCellVoltageForPressurePlot and one called newPressure for pressure. Pressure and cellvoltages are the 2 y axis and time is the x axis. Cell voltage is a 2d array and time and pressure are 1d arrays. Now the problem is cell voltages. There are 84 cell voltages and when I plot them they are all coming in the same colour. Here is the code below :
lx = axes;
yyaxis(lx,'left');
plot(lx,BatteryNewTimeSection,allCellVoltageForPressurePlot);
yyaxis(lx,'right');
plot(lx,BatteryNewTimeSection,newPressure);
and here is the plot

As you can see all the cell voltages appear as one colour.
I tried plotting it single y without the pressure and there it works. here is the code :
lx = axes;
plot(lx,BatteryNewTimeSection,allCellVoltageForPressurePlot);
and here is the plot :

So why is this happening, the top is all colour and bottom is correct with multi color cell voltages and how can I correct this.I have also uploaded the three arrays as .mat file. Thank you.
Accepted Answer
More Answers (0)
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
