Home > OS >  Scatter plot for non-numeric DataFrame
Scatter plot for non-numeric DataFrame

Time:12-03

I have a DataFrame that consists only of non-numeric data. I have two exemplary sequences:

seq_1 = 'AATGMAM'
seq_2 = 'TATAMTM'

Where one of these sequences is used as columns, and the second one as the index. If the letter overlaps, the DataFrame is filled with a '*' sign. Otherwise, the value is ''.

data = [["*" if p1 == p2 else "" for p2 in seq_2] for p1 in seq_1]
df = pd.DataFrame(data, columns=list(seq_1), index=list(seq_2)

  A A T G M A M
T     *        
A * *       *
T     *
A * *       *
M
T     *
M         *   *

Now I want to create a scatter plot that would depict this DataFrame. The x-axis should be the index and y-axis the columns. How can I do that?

CodePudding user response:

You can get the coordinates for the scatter plot using enter image description here

  • Related