Data visualisation- pandas area plot vs pyplot stackplot

i have created stacked area plot from pandas and with pyplot as well…
But in the results,i can see the deceased blue color in area plot but can’t see it in the pyplot,can you tell me the reason and how to correct it.
also i want the same colors in both the graphs,I searched for the methods but couldn’t get one so ended up doing the cmap but still with different colors.

Hi @ambika.insa1994,
Maybe you can pass a list of color pallets to the colors argument.
Referring this article may help.

and how to customize the colors in pandas area plot.I can only use the existing colormap.

This thread might help

also,there is a difference in both the graphs visualisations,the pandas graphs shows proper blue line for deceased. but the stackplot dont show it. what is the reason?

If you just want the same colors as ‘RdYlBu’, you can pass the same set of colors to stackplot explicitly.
colors=['Red', 'Yellow', 'Blue']

i did it already but they were still not the same colors,the contrast were different. I want to have the same pxel intensity of the colors.

  1. I got the palette #HEX number corresponding to the pandas area RdYlBu colormap,
  2. then I created my own color palette for the stackplot
  3. and to remove the white line seperating the plots, I set the linewidth=0.
  4. I fit the stackplot to the figure by setting plt.margins(0,0).
1 Like