I am trying to plot a bar chart that shows reactivity values corresponding to bases in an RNA.
The data is like this:
x = [āGā, āGā, āAā, āAā, āAā, āCā, āCā, āGā, āAā, āAā, āUā, āCā, āGā, āGā, āAā, āGā, āAā, āCā, āUā, āAā, āCā, āUā, āAā, āUā, āAā, āGā, āUā, āUā, āGā, āAā, āGā, āUā, āAā, āAā, āUā, āCā, āGā, āUā, āCā, āGā, āAā, āCā, āUā, āUā, āUā, āAā, āUā, āGā, āCā, āGā, āAā, āUā, āCā, āGā, āUā, āAā, āUā, āUā, āAā, āCā, āUā, āGā, āCā, āUā, āAā, āCā, āGā, āAā]
y = [0.26130000000000003, 0.38420000000000004, 0.13720000000000002, 0.2531, 0.17980000000000002, 0.1371, 0.1736, 0.1791, 0.1056, 0.18960000000000002, 0.183ā¦] (corresponding to each alphabet in the previous list)
I made a function which plots a graph like this:
But I want it like this:

Here is the code:
def grapher(ids, option):
fig = go.Figure()
for id_ in ids:
y = sequences[id_][option]
fig.add_trace(
go.Bar(
x=list(sequences[id_]["sequence"]),
y=y,
name=id_ + "<br>" + sequences[id_]["sequence"],
)
)
fig.update_layout(title=option, barmode="relative", bargap=0.1)
return fig
What can I do to get the result I want?
Please assume that the desired x and y values are fed into the function.
Thanks!