1
votes

I want to create horizontal stack graph like belowgraph

Arr1, Arr2, Arr3, Arr4 are in range 0-1 and length is about 50000 each.

Short Example of length 10:

Array 1 2 3 4 5 6 7 8 9 10
Arr1 0.1 0.1 0.1 0.2 0.2 0.2 0.7 0.7 0.4 0.7
Arr2 0.6 0.6 0.6 0.1 0.1 0.1 0.1 0.1 0.5 0.1
Arr3 0.3 0.3 0.3 0.7 0.7 0.7 0.2 0.2 0.1 0.2
Arr4 0.4 0.6 0.7 0.2 0.1 0.3 0.4 0.5 0.3 0.9
B a a a b b b a a a b

How can I plot each Arr1, Arr2, Arr3, Arr4 from light to dark based on their value in horizontal graph (or greyscale with each value be different shade of grey).

The values closer to 0 will me light in color and values closer to 1 will be dark. 0 will be white and 1 will black when using greyscale.

In picture Arr1: low values will be light yellow and high values will be dar yellow(all values are between 0 and 1)

Last bar is different, Array: B is list of a and b, how can I plot different color for each occurrence of a and b.

In picture for B: occurrences of a will be colored green and occurrences of b will be colored pink.

I would not worry much about the layout of the outer box, I would just use ggarrange to put all graph in a single plot

What have you tried? SO is not a coding service. Please read the following documentation, then edit, and rephrase the question. Take the Tour, How to ask a good question, & On Topic. Always provide a minimal reproducible example with code, data, errors, current & expected output, as formatted text & you're expected to try to solve the problem first and show your effort.Trenton McKinney
Do not flag irrelevant tags. Is this a matplotlib question or a ggplot2 question.Trenton McKinney
@TrentonMcKinney I am comfortable with both.Rahil Vora