interactive_plotting
interactive_plotting copied to clipboard
bokeh interactive server - toy example?
Hi @michalk8,
I cannot show ipl plots in the bokeh interactive servers. So far, the latest attempt shows a white webpage where the expected UMAP is generated according to the terminal log, but it is not shown.
Example below with test anndata.
from random import random
from bokeh.layouts import column
from bokeh.models import Button
from bokeh.palettes import RdYlBu3
from bokeh.plotting import figure, curdoc
from bokeh.io import show
import holoviews as hv # needed for scatter, scatterc and dpt
hv.extension('bokeh')
from os.path import exists
######################
### INTERACTIVE PYTHON VISUALIZATIONS
# this is necessary to plot the interactive umap visualization in the
import warnings
warnings.filterwarnings(action='ignore')
import numpy as np
import scanpy as sc
import re
import interactive_plotting as ipl
import holoviews as hv
hv.extension('bokeh')
bkp_path_h5ad = '../data/scfates_pancreas.h5ad'
ad = sc.read(bkp_path_h5ad)
p = ipl.scatterc(ad, basis=['umap'], hover=True)
# print(type(p))
print('plotting in mode renderer...')
show(p[1])
print('done...')
to run the server I execute.
bokeh serve bokeh_app_umap.py --port 8883 --allow-websocket-origin=localhost:8883
Is there a toy script to start and see the interactive behavior in the ipl visualizations as interactive servers? That would be useful. I will keep exploring as notebooks meanwhile.
Thanks,
Hi @ilibarra , this should work (tested it with some data):
from random import random
from bokeh.layouts import column
from bokeh.models import Button
from bokeh.palettes import RdYlBu3
from bokeh.plotting import figure, curdoc
from bokeh.io import show
import holoviews as hv # needed for scatter, scatterc and dpt
hv.extension('bokeh')
from os.path import exists
######################
### INTERACTIVE PYTHON VISUALIZATIONS
# this is necessary to plot the interactive umap visualization in the
import warnings
warnings.filterwarnings(action='ignore')
import numpy as np
import scanpy as sc
import re
import interactive_plotting as ipl
import holoviews as hv
import panel as pn # Added
hv.extension('bokeh')
bkp_path_h5ad = '../data/scfates_pancreas.h5ad'
ad = sc.read(bkp_path_h5ad)
p = ipl.scatterc(ad, basis=['umap'], hover=True)
# print(type(p))
print('plotting in mode renderer...')
pn.panel(p).servable(title='Some title') # Changed
print('done...')
and then run:
panel serve bokeh_app_umap.py --port 8883 --allow-websocket-origin=localhost:8883
Though I'd beware, this project isn't maintained anymore, so there might be bugs.