import plotly.plotly as py
gvallverdu306 = py.get_figure('https://plot.ly/~gvallverdu/249/bands-diagram-of-silicon.py')
gvallverdu306['data'] = gvallverdu306['data'][0:8]
gvallverdu306['layout']['xaxis']['tickmode'] = 'array'
gvallverdu306['layout']['xaxis']['showticklabels'] = True
gvallverdu306['layout']['xaxis']['tickvals'] = [
0, 20, 40, 60, 80, 120, 140, 159
]
gvallverdu306['layout']['xaxis']['ticktext'] = [
"L", "Λ", "Γ", "Δ<sub>k</sub>",
"X", "K", "Σ", "Γ"
]
N.B. This is a new plotly feature that hasn't made it into the python-api yet.
We must turn off validatation in order to use it.
py.iplot(
gvallverdu306,
validate=False,
filename='tickvals-ticktext'
)
vals = [0, 20, 40, 60, 80, 120, 140, 159]
gvallverdu306['layout']['shapes'] = []
for val in vals:
gvallverdu306['layout']['shapes'].append({
'type': 'line',
'xref': 'x',
'x0': val,
'x1': val,
'yref': 'paper',
'y0': 0,
'y1': 1,
'opacity': 0.6
})
py.iplot(
gvallverdu306,
validate=False,
filename='tickvals-ticktext-shapes'
)
from IPython.display import display, HTML
import urllib2
url = 'https://raw.githubusercontent.com/plotly/python-user-guide/master/custom.css'
display(HTML(urllib2.urlopen(url).read()))