I'm trying to create a plot like the one shown in the picture below - where for each x value (a trading period) the y values (Megawatt, MW, see table below) are stacked on top of each other in order of the price (shown in the table below). I then need each megawatt segment to be colored in terms of the price, so that the general price at any given MW level can be easily read from the graph.

The table below shows example data for one X-value (one trading period). This is what I wish to be stacked.

I thought that this might be possible by using either a stacked bar plot or a stacked area graph and assigning a colormap, however most implementations of these I can find using Pandas, Matplotlib, or Seaborn require each level across the graph to be its own series, which is then assigned a color. This would be an issue for me as the number of values I wish to stack may change for each x-value, and I want the color of each segment (Megawatt) to reflect the price associated with that segment (DollarsPerMegawattHour).

Any suggestions as to how this may be achieved? Having a color scale legend as shown in the example below would also be good...

enter image description here enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.