:orphan: :html_theme.sidebar_secondary.remove: .. This document is auto-generated by the altair-gallery extension. Do not modify directly. .. _gallery_pyramid: Pyramid Pie Chart ----------------- Altair reproduction of http://robslink.com/SAS/democd91/pyramid_pie.htm .. altair-plot:: :remove-code: import altair as alt import pandas as pd category = ['Sky', 'Shady side of a pyramid', 'Sunny side of a pyramid'] color = ["#416D9D", "#674028", "#DEAC58"] df = pd.DataFrame({'category': category, 'value': [75, 10, 15]}) alt.Chart(df).mark_arc(outerRadius=80).encode( alt.Theta('value:Q', scale=alt.Scale(range=[2.356, 8.639])), alt.Color('category:N', scale=alt.Scale(domain=category, range=color), legend=alt.Legend(title=None, orient='none', legendX=160, legendY=50)), order='value:Q' ).properties(width=150, height=150).configure_view(strokeOpacity=0) .. tab-set:: .. tab-item:: Method syntax :sync: method .. code:: python import altair as alt import pandas as pd category = ['Sky', 'Shady side of a pyramid', 'Sunny side of a pyramid'] color = ["#416D9D", "#674028", "#DEAC58"] df = pd.DataFrame({'category': category, 'value': [75, 10, 15]}) alt.Chart(df, width=150, height=150).mark_arc(outerRadius=80).encode( alt.Theta('value:Q').scale(range=[2.356, 8.639]), alt.Color('category:N') .title(None) .scale(domain=category, range=color) .legend(orient='none', legendX=160, legendY=50), order='value:Q' ).configure_view( strokeOpacity=0 ) .. tab-item:: Attribute syntax :sync: attribute .. code:: python import altair as alt import pandas as pd category = ['Sky', 'Shady side of a pyramid', 'Sunny side of a pyramid'] color = ["#416D9D", "#674028", "#DEAC58"] df = pd.DataFrame({'category': category, 'value': [75, 10, 15]}) alt.Chart(df).mark_arc(outerRadius=80).encode( alt.Theta('value:Q', scale=alt.Scale(range=[2.356, 8.639])), alt.Color('category:N', scale=alt.Scale(domain=category, range=color), legend=alt.Legend(title=None, orient='none', legendX=160, legendY=50)), order='value:Q' ).properties(width=150, height=150).configure_view(strokeOpacity=0)