#!/usr/bin/env python # coding: utf-8 # #

     Controlling size in Lightning # ##
Setup # In[1]: import os from lightning import Lightning from numpy import random # ## Connect to server # In[2]: lgn = Lightning(ipython=True, host='http://public.lightning-viz.org') # ##
Sizing individual plots # The Lightning client let's you easily control plot size by specifying the width in pixels. Let's try a few sizes for the same plot. # In[3]: x = random.rand(100) y = random.rand(100) mat = random.rand(100,100) mat[mat<0.99] = 0 # In[4]: lgn.graph(x, y, mat, width=400) # In[5]: lgn.graph(x, y, mat, width=800) # ##
Global size # Especially when working in the notebook, it can be useful to specify a size globally. We've predefined four sizes: small, medium, large, and full. Generally, full will be the largest, but full is also adaptive and will match the size of the enclosing div, whereas the others correspond to fixed pixel widths of 400, 600, and 800. The default for notebooks is medium, but for some plot types and use cases you may prefer others. # In[6]: series = random.randn(5,50) # In[7]: lgn.set_size('small') lgn.line(series) # In[8]: lgn.set_size('medium') lgn.line(series) # In[9]: lgn.set_size('large') lgn.line(series) # In[10]: lgn.set_size('full') lgn.line(series)