Plotting data with Matlab
Show older comments
Hello,
I am having an issue plotting some data. I have some arrays with 40000+ cells that are coming from my gams model which represent hours for some years. For example, I have power production and consumption for a wind park with battery integrated for each hour of 4 years. Is there any way to plot them and have a visible plot with so much data ( because in my case the boxplot or the simple plot did not work really well) ? Because of the problem that I mentioned I am trying to make plots with the mean value per hour, so I have only 24 values from each array and I want to put them all to the same figure but to appear like in the pics that I uploaded. More specifically, I want to plot those values in a way that they are visible, good in presentation(like those below) and at the same time to show that they are part of the equation Pnetwork=Pproduced-Pconsumed+Pwind (all 4 are arrays), so there are some arrays to be plotted that add up and one that is subtracted and I want to show that this (Pproduced-Pconsumed+Pwind) is actually equal to Pnetwork. I tried some code like this below. Any advice on what I can do?plot(mean_pr,'LineWidth',1,'LineStyle','--','Color',[0.1 0.3 0.5]);
area(mean_con,'FaceColor',[0.5 0.3 0.1],'EdgeColor','none','FaceAlpha',0.6);
Thanks for your time in advance.

4 Comments
dpb
on 24 Oct 2022
The LH side is an area plot with superimposed line on the two topmost areas and some other line (in lighter gray) at the bottom.
It would be much easier with a representative sample of the data; I'd suggest using the original data; looks like you may have fallen into the trap of building additional named variables to do the averaging, etc., that's the hard way to go about it; easier to illustrate if have raw data from which to work initially and may as well use the real thing instead of trying to make something up that just take time/effort and may not match...
panagiotis skrempos
on 25 Oct 2022
I already suggested area which is precisely what the LH plot is with the pieces built as per the documentation describing the functionality --
"If Y is a matrix, the plot contains one curve for each column in Y. area fills the areas between the curves and stacks them, showing the relative contribution of each row element to the total height at each x-coordinate."
Hence your columns would need to be made up of the the three components [Pproduced, -Pconsumed, +Pwind] and the plotting function will produce the Pnetwork total automagically as the summation of the three.
I don't know what "I want to show that this (Pproduced-Pconsumed+Pwind) is actually equal to Pnetwork" really means; if they are computed as above there cannot possibly be anything except that the total matches the sum of the components. If you somehow have an independent measure of Pnetwork that is a real system and the other is a model trying to predict that, then that would be another that wouldn't necessarily match, but you didn't indicate having such.
You did not respond to the request to attach some of the actual data; not much else to be done without something to poke at but generalities.
panagiotis skrempos
on 27 Oct 2022
Answers (0)
Categories
Find more on 2-D and 3-D Plots 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!