Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polar Plot for similarity molecules #14

Open
kpinto-gil opened this issue Aug 5, 2019 · 1 comment
Open

Polar Plot for similarity molecules #14

kpinto-gil opened this issue Aug 5, 2019 · 1 comment

Comments

@kpinto-gil
Copy link

kpinto-gil commented Aug 5, 2019

Here is the python code for radial plot:

def radialplot(df, tnames, simcol,dilicol):
    ''' eg. radialplot(adf, 'atc_names_train', 'Tanimoto_fp', 'H_HT_class_train')'''
    labels = df[tnames].values
    stats = df[simcol].values
    dili = df[dilicol].values
    angles = np.linspace(0.07, 2*np.pi, len(labels), endpoint=False)
    stats = np.concatenate((stats,[stats[0]]))
    angles = np.concatenate((angles,[angles[0]]))
    fig=plt.figure(figsize=(10,20))

    ax = fig.add_subplot(111, polar=True)
    ax.plot(angles, stats, 'o',  linewidth=2, color='red')
    ax.fill(angles, stats, alpha=0.25, color='red')
    ax.set_thetagrids(angles * 180/np.pi, labels)
    ax.tick_params(pad=35)
    ax.set_rmax(1)
    ax.tick_params(axis='y', which='major', labelsize=14)

    ax.set_rticks([round(i,1) for i in np.linspace(0,1,11)])
    ax.set_rlabel_position(0)
    # ax.set_title('Reference: '+refname)
    ax.tick_params(axis='x', which='major', labelsize=18, grid_linestyle='-')

    ax.grid(True)
    sns.set_style("white")
@kpinto-gil
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant