Note
Go to the end to download the full example code.
Sector textΒΆ
A text can be shown in a sector by the texts argument.
import plotly
import ptvis
elements = list(ptvis.Element) * 2
texts = [str(i % 10) for i in range(len(elements))]
fig = plotly.graph_objects.Figure()
ptvis.attach_pie_cells(fig, elements, texts=texts)
plotly.io.show(fig)
The color of texts are selected so as to be a high contrast ratio to a sector. Candidates for the text color can be given by the text_colorway argument.
import plotly
import ptvis
elements = list(ptvis.Element) * 2
texts = [str(i % 10) for i in range(len(elements))]
fig = plotly.graph_objects.Figure()
ptvis.attach_pie_cells(
fig,
elements,
texts=texts,
text_colorway=["#ff0000", "#ffcccc"],
)
plotly.io.show(fig)