--- title: Interactive Plots keywords: fastai sidebar: home_sidebar summary: "We use plotly for interactive plotting. Data for plotly is obtained using `pivotpy.i_plots.create_rgb_lines`." description: "We use plotly for interactive plotting. Data for plotly is obtained using `pivotpy.i_plots.create_rgb_lines`." nb_path: "InteractivePlots.ipynb" ---
import os
import pivotpy as pp
os.chdir('E:/Research/graphene_example/ISPIN_2/bands')
fig=iplot_rgb_lines(mode='lines',elim=[-10,10],orbs=[[0],[1],[2,3]],labels=['s','p<sub>z</sub>','p<sub>x</sub>+p<sub>y</sub>'], ktick_inds=[0,30,60,-1],ktick_vals=['Γ','M','K','Γ'],E_Fermi=-2.7735)
iplot2html(fig,modebar=False)
iplot_rgb_lines
make_subplots
object by getting data=iplot_rgb_lines().data
and layout=iplot_rgb_lines().layout
objects. See example below: import plotly.graph_objects as go
from IPython.display import HTML
import pivotpy.i_plots as ips
import os
from plotly.subplots import make_subplots
os.chdir('E:/Research/graphene_example/ISPIN_1/bands')
inds=[0,30,60,-1]
lbs=['Γ','M','K','Γ']
kargs=dict(mode='markers',elim=[-10,10],ktick_inds=inds,ktick_vals=lbs)
fig5 = make_subplots(rows=2, cols=2,shared_yaxes=True,shared_xaxes=True,
horizontal_spacing=0.08,
vertical_spacing=0.1,
subplot_titles=['s','pz','py','s,p,d'],
column_widths=[1,2],
row_heights=[1,2],
y_title='Energy (eV)'
)
[fig5.add_trace(trace,row=1,col=1) for trace in ips.iplot_rgb_lines(orbs=[0,[],[]],**kargs).data]
[fig5.add_trace(trace,row=1,col=2) for trace in ips.iplot_rgb_lines(orbs=[[],[1],[]],**kargs).data]
[fig5.add_trace(trace,row=2,col=1) for trace in ips.iplot_rgb_lines(orbs=[[],[],[2]],**kargs).data]
last=ips.iplot_rgb_lines(**kargs)
[fig5.add_trace(trace,row=2,col=2) for trace in last.data]
fig5.update_layout(width=600,height=400,font=last.layout.font,margin=dict(r=10,l=10,t=40,b=40))
fig5.update_xaxes(last.layout.xaxis)
last.layout.yaxis.title=''
fig5.update_yaxes(last.layout.yaxis)
iplot2html(fig5,modebar=False)
Click on gridplot.html to see the plot generated from above code.
_collect_dos
in Plotly splot_dos_lines
is created in plotly below. Plotly will reduce number of parameters and you are able to tweek those parameters interactively in graph.import pivotpy as pp
fig=iplot_dos_lines(path_evr='E:/Research/graphene_example/ISPIN_2/dos/vasprun.xml',vertical=False,fill_area=True,elements=[[0],[1],[]],orbs=[0,1,[2,3]],labels=['C1-s','C2-p<sub>z</sub>','None-p<sub>x</sub>+p<sub>y</sub>'],figsize=(700,550),colormap='RGB')
iplot2html(fig,modebar=False)