0

I have two lists in Python and they look like this

lst1 = ['T', 'A', 'T', 'G', 'C', 'A', 'T', 'G', 'C', 'C', 'G', 'T', 'A']

lst2 = [0, 0, 0, 0, 0, 2, 2, 2, 1, 2, 1, 0, 0]

It's a nucleotide sequence, so the first A is obviously different from the next. By simply using

plt.plot(lst1, lst2)
plt.show()

The repeating characters on the X axis is being combined into just the 4 distinct ones. Is there any way I can plot against such a sequence of characters with repetitions?

Ajax1234
  • 69,937
  • 8
  • 61
  • 102
Rangan Das
  • 323
  • 2
  • 11
  • How should the combined values in `lst2` be handled? For each listing of values in `lst2` corresponding to a character in `list1`, should the values be summed? – Ajax1234 Mar 06 '18 at 17:32
  • 1
    Please read and follow the posting guidelines in the help documentation. [Minimal, complete, verifiable example](http://stackoverflow.com/help/mcve) applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described. In particular, it's not clear what output you expect. If you want to get the sequence in its given order, then your x-axis values need to be that ordering (i.e. [1, 2, 3, 4, 5, ...] This leaves you with *two* lists to plot ... ? – Prune Mar 06 '18 at 17:32

0 Answers0