diff --git a/GoVizzy/gv_ui/gv_ui/DisplayUI.py b/GoVizzy/gv_ui/gv_ui/DisplayUI.py index 027931b..dae2e99 100644 --- a/GoVizzy/gv_ui/gv_ui/DisplayUI.py +++ b/GoVizzy/gv_ui/gv_ui/DisplayUI.py @@ -121,7 +121,8 @@ def display_app(): gvWidgets.slice_y_check, gvWidgets.slice_z_slider, gvWidgets.slice_z_check, - figure_controls]) + gvWidgets.slice_color, + figure_controls,]) display(slice_box) diff --git a/GoVizzy/gv_ui/gv_ui/gvWidgets.py b/GoVizzy/gv_ui/gv_ui/gvWidgets.py index c579d5c..327d561 100644 --- a/GoVizzy/gv_ui/gv_ui/gvWidgets.py +++ b/GoVizzy/gv_ui/gv_ui/gvWidgets.py @@ -3,7 +3,7 @@ Documentation for widget library: https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html#file-upload ''' from IPython.display import display -from ipywidgets import Layout, Button, Box, Textarea, Label, ColorPicker, FloatSlider, Checkbox, link, BoundedFloatText, IntSlider +from ipywidgets import Layout, Button, Box, Textarea, Label, ColorPicker, FloatSlider, Checkbox, link, BoundedFloatText, IntSlider, Dropdown from ipyvolume.widgets import Mesh, Scatter import numpy as np @@ -67,6 +67,13 @@ indent=True ) +slice_color = Dropdown( + options=['Grays', 'Reds', 'Oranges', 'Greens', 'Blues', 'Purples'], + description='Slice Color Scheme', + disabled=False, + indent=True +) + bond_visibility_toggle = Checkbox( value=True, description='Bond Visibility', @@ -75,7 +82,7 @@ ) bond_color_picker = ColorPicker( - value="black", + value="black", description="Bond Color" ) @@ -146,7 +153,7 @@ def atom_scale_slider(atom: Mesh, description: str="Scale"): # Input form items form_items = [ - Box([Label(value='Path to .cube file'), + Box([Label(value='Path to .cube file'), Textarea()], layout=form_item_layout), color, Button(description='Submit', layout=Layout(flex='1 1 0%', width='auto')), @@ -162,4 +169,4 @@ def atom_scale_slider(atom: Mesh, description: str="Scale"): width='50%' )) -form, color, slice_x_slider, slice_y_slider, slice_z_slider, slice_x_check, slice_y_check, slice_z_check, bond_scale_slider, bond_color_picker, bond_visibility_toggle +form, color, slice_x_slider, slice_y_slider, slice_z_slider, slice_x_check, slice_y_check, slice_z_check, slice_color, bond_scale_slider, bond_color_picker, bond_visibility_toggle diff --git a/GoVizzy/gv_ui/gv_ui/plotting.py b/GoVizzy/gv_ui/gv_ui/plotting.py index 1d8f2ef..0e7e929 100644 --- a/GoVizzy/gv_ui/gv_ui/plotting.py +++ b/GoVizzy/gv_ui/gv_ui/plotting.py @@ -150,9 +150,10 @@ def display_cell_slices(self): # Slice order is different to match ipyvolume, which plots the volume in a y-up orientation def update(x = 0, y = 0, z = 0): - xSlice.imshow(cube.data3D[:, :, x]) - ySlice.imshow(cube.data3D[:, y, :]) - zSlice.imshow(cube.data3D[z, :, :]) + color = str(gvWidgets.slice_color.value) + xSlice.imshow(cube.data3D[:, :, x], cmap=color,) + ySlice.imshow(cube.data3D[:, y, :], cmap=color,) + zSlice.imshow(cube.data3D[z, :, :], cmap=color,) plt.show() out = widgets.interactive_output(update, {'x':gvWidgets.slice_x_slider,