In [1]:
from chemview.gg import *
from chemview.install import enable_notebook
import numpy as np
enable_notebook()
In [2]:
xyz = np.random.rand(10, 10, 3)
colors = (np.random.rand(10, 10) * 2**32).astype('int')
gg = ggtraj(10, Aes(xyz_traj=xyz, colors=["Cl"] * 10)) + GeomPoints()
#t, mm = gg.display()
#t.attach("fullscreen", mm)
In [3]:
xyz = np.random.rand(10, 10, 3)
colors_traj = (np.random.rand(10, 10) * 2**32).astype('int')
#colors = np.arange(10).astype('float')
gg = ggtraj(10, Aes(xyz_traj=xyz, colors_traj=colors_traj)) + GeomPoints() + ScaleColorsGradient(limits=[0, 5], palette="viridis")
t, mm = gg.display()
In [18]:
from matplotlib import pyplot
import matplotlib as mpl
# Make a figure and axes with dimensions as desired.
fig = pyplot.figure(figsize=(8, 3))
ax1 = fig.add_axes([0.05, 0.80, 0.9, 0.15])
# Set the colormap and norm to correspond to the data for which
# the colorbar will be used.
cmap = mpl.cm.viridis
norm = mpl.colors.Normalize(vmin=5, vmax=10)
# ColorbarBase derives from ScalarMappable and puts a colorbar
# in a specified axes, so it has everything needed for a
# standalone colorbar. There are many more kwargs, but the
# following gives a basic continuous colorbar with ticks
# and labels.
cb1 = mpl.colorbar.ColorbarBase(ax1, cmap=cmap,
norm=norm,
orientation='horizontal')
#cb1.set_label('Some Units')
from IPython.display import display, display_png, Image
from cStringIO import StringIO
data = StringIO()
fig.savefig(data, format="png")
Image(data=data.getvalue())
#mpl.pyplot.show()
Out[18]:
In [2]:
from ipywidgets import widgets
from IPython.display import display
first = widgets.Text(description="First:")
last = widgets.Text(description="Last:")
last._dom_classes = ["test"]
last._css = [('.test', 'position', 'absolute'),
('.test', 'top', '0px'),
('.test', 'right', '0px'),]
form = widgets.Box(children=[first, last])
form._dom_classes = ["test2"]
form._css = [('.test2', 'position', 'relative')]
display(form)
In [13]:
import ipywidgets
ipywidgets.__version__
Out[13]:
In [ ]:
In [ ]:
In [ ]: