#!/usr/bin/env python
# coding: utf-8
# #
Image plots in Lightning
# ##
Setup
# In[46]:
from lightning import Lightning
from numpy import random, asarray, concatenate
from sklearn import datasets
# ## Connect to server
# In[47]:
lgn = Lightning(ipython=True, host='http://public.lightning-viz.org')
# ##
Basic image viewing
# The image plot type shows an image with zooming and panning.
#
# Lightning's image viewer is powered by leaflet, so easily handles panning through very large images.
# In[48]:
imgs = datasets.load_sample_images().images
lgn.image(imgs[0])
# Single-channel images will automatically be presented as grayscale.
# In[49]:
imgs = datasets.load_sample_images().images
lgn.image(imgs[0][:,:,0])
# The usual sizing arguments can be used to set the image size in pixels.
# In[50]:
imgs = datasets.load_sample_images().images
lgn.image(imgs[0], width=400)