Skip to content

Instantly share code, notes, and snippets.

@sbassi
Last active May 6, 2020 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbassi/5ec429f6a0294d6a5f20cf4f4413a6cf to your computer and use it in GitHub Desktop.
Save sbassi/5ec429f6a0294d6a5f20cf4f4413a6cf to your computer and use it in GitHub Desktop.
from bokeh.plotting import figure, show
from pandas import read_csv
from bokeh.models.markers import marker_types
from bokeh.transform import factor_cmap, factor_mark
df = read_csv('samples/fishdata.csv')
all_markers = [mt for mt in marker_types]
SPECIES = list(set(df['species']))
MARKERS = all_markers[:len(SPECIES)]
feeds = list(set(df['feeds']))
p = figure(plot_height=600, plot_width=700,
title =
'Metabolic variations based on 1H NMR profiling of fishes'
)
p.xaxis.axis_label = 'Principal Component 1: 35.8%'
p.yaxis.axis_label = 'Principal Component 2: 15.1%'
p.scatter('PC1', 'PC2', source=df, size=12,
fill_alpha=0.3,
marker=factor_mark('species', MARKERS, SPECIES),
color=factor_cmap('feeds', 'Category10_3', feeds)
)
output_notebook()
show(p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment