Last active
May 6, 2020 03:29
-
-
Save sbassi/5ec429f6a0294d6a5f20cf4f4413a6cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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