Note
Go to the end to download the full example code.
BasicsΒΆ
The ptvis.attach_pie_cells() function attaches the periodic table with
pie chart cells. An item of passed data corresponds with a sector.
import plotly
import ptvis
elements = [
element
for element in ptvis.Element
for _ in range((element.value-1)%3 + 1) # noqa: E228
]
fig = plotly.graph_objects.Figure()
ptvis.attach_pie_cells(fig, elements)
plotly.io.show(fig)
Cells are drawn only for given elements.
import plotly
import ptvis
elements = [
ptvis.Element(z)
for z in range(1, 51)
for _ in range((z-1)%3 + 1) # noqa: E228
]
fig = plotly.graph_objects.Figure()
ptvis.attach_pie_cells(fig, elements)
plotly.io.show(fig)