Closed ZeeshanAbbas92 closed 3 years ago
Hi Zeeshan,
Your dataframe elements, as you've written them, appear to have str (string) as their datatype. Logomaker requires its input pandas dataframe (to the Logo constructor) to have numbers as its elements, e.g., float, or int. I've initialized your numpy array as numbers and assumed (based on the shape of your matrix) that you were trying to plot a DNA logo of sequence length 7. This gives the output the picture below. However this isn't a logomaker issue so I am closing this.
This is my code below:
import pandas as pd import numpy as np import seqlogo import logomaker
m46 = np.matrix('1.000000 0.000000 0.000000 0.000000;\ 0.000000 1.000000 0.000000 0.000000;\ 1.000000 0.000000 0.000000 0.000000;\ 0.318996 0.275710 0.237386 0.167907;\ 0.398952 0.263579 0.173146 0.164323;\ 0.327819 0.293631 0.181141 0.197408;\ 0.342707 0.290047 0.191067 0.176179')
crp_df = pd.DataFrame(m46) logomaker.Logo(df=crp_df, font_name='Arial Rounded MT Bold', fade_below=0.5, shade_below=0.5, figsize=(10,3))
It returns the error: KeyError: '1' at line 1112 of /logomaker/src/Logo.py
Would you please guide me if I am doing something wrong?