[{"data":1,"prerenderedAt":685},["ShallowReactive",2],{"content-query-u4tIpQHKHP":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"heading":10,"prompt":11,"tags":15,"files":18,"nav":6,"presets":19,"gallery":37,"body":39,"_type":678,"_id":679,"_source":680,"_file":681,"_stem":682,"_extension":683,"sitemap":684},"/tools/ternary-plot","tools",false,"","Ternary Plot Generator for Compositional Data","Create ternary plots online from Excel and CSV data. Visualize three-part compositions such as mixes, proportions, and shares with AI.","Ternary Plot Generator",{"prefix":12,"label":13,"placeholder":14},"Create a ternary plot","Describe the ternary plot you want to create","e.g. ternary plot of electricity generation by fossil, nuclear, and renewable share per country",[16,17],"charts","science",true,[20,26,32],{"label":21,"prompt":22,"dataset_url":23,"dataset_title":24,"dataset_citation":25},"Electricity mix by country","ternary plot of electricity generation by fossil fuels, nuclear, and renewables share for each country in the most recent year; color points by continent; label outlier countries","https://ourworldindata.org/grapher/share-of-electricity-production-by-source.csv","Share of electricity production by source","Our World in Data",{"label":27,"prompt":28,"dataset_url":29,"dataset_title":30,"dataset_citation":31},"Employment by sector","ternary plot of employment share in agriculture, industry, and services by country for the most recent year; color by World Bank income group; size points by total labor force","https://api.worldbank.org/v2/en/indicator/SL.AGR.EMPL.ZS?downloadformat=excel","Employment in agriculture, industry, and services (% of total)","World Bank",{"label":33,"prompt":34,"dataset_url":35,"dataset_title":36,"dataset_citation":25},"Energy consumption by source","ternary plot of primary energy consumption split into fossil fuels, nuclear, and renewables for each country; color by region; annotate the top 10 largest energy consumers","https://ourworldindata.org/grapher/primary-energy-source-bar.csv","Primary energy consumption by source",[38],"/img/tools/ternary-plot.png",{"type":40,"children":41,"toc":668},"root",[42,51,72,112,117,123,173,179,319,331,337,439,445,552,558,587,593,609,633,658],{"type":43,"tag":44,"props":45,"children":47},"element","h2",{"id":46},"what-is-a-ternary-plot",[48],{"type":49,"value":50},"text","What Is a Ternary Plot?",{"type":43,"tag":52,"props":53,"children":54},"p",{},[55,57,63,65,70],{"type":49,"value":56},"A ",{"type":43,"tag":58,"props":59,"children":60},"strong",{},[61],{"type":49,"value":62},"ternary plot",{"type":49,"value":64}," (also called a triangle plot or trilinear diagram) represents the composition of mixtures where ",{"type":43,"tag":58,"props":66,"children":67},{},[68],{"type":49,"value":69},"three components always sum to a constant",{"type":49,"value":71}," — typically 100% or 1. Each of the three vertices of the equilateral triangle represents 100% of one component. Any point inside the triangle encodes the proportions of all three components simultaneously: its perpendicular distance from each side gives the share of the opposite component.",{"type":43,"tag":52,"props":73,"children":74},{},[75,77,82,84,89,91,96,98,103,105,110],{"type":49,"value":76},"The key insight is that ternary plots compress three-dimensional compositional data into a two-dimensional space without losing information, because the three components are ",{"type":43,"tag":58,"props":78,"children":79},{},[80],{"type":49,"value":81},"not independent",{"type":49,"value":83}," — knowing any two tells you the third. They are widely used in ",{"type":43,"tag":58,"props":85,"children":86},{},[87],{"type":49,"value":88},"geochemistry",{"type":49,"value":90}," (rock mineral composition), ",{"type":43,"tag":58,"props":92,"children":93},{},[94],{"type":49,"value":95},"materials science",{"type":49,"value":97}," (alloy or polymer blends), ",{"type":43,"tag":58,"props":99,"children":100},{},[101],{"type":49,"value":102},"ecology",{"type":49,"value":104}," (land use: cropland/forest/urban), and ",{"type":43,"tag":58,"props":106,"children":107},{},[108],{"type":49,"value":109},"economics",{"type":49,"value":111}," (employment by sector: agriculture/industry/services). A country with 70% fossil fuel electricity, 10% nuclear, and 20% renewables is one specific point in the triangle — and plotting many countries at once reveals clusters of similar energy strategies.",{"type":43,"tag":52,"props":113,"children":114},{},[115],{"type":49,"value":116},"Unlike a scatter plot where both axes are independent, moving along any direction in a ternary plot always involves trade-offs between all three components. A country that increases its renewable share must necessarily decrease its fossil or nuclear share — and the ternary plot makes this constraint and its consequences visually explicit.",{"type":43,"tag":44,"props":118,"children":120},{"id":119},"how-it-works",[121],{"type":49,"value":122},"How It Works",{"type":43,"tag":124,"props":125,"children":126},"ol",{},[127,138,154],{"type":43,"tag":128,"props":129,"children":130},"li",{},[131,136],{"type":43,"tag":58,"props":132,"children":133},{},[134],{"type":49,"value":135},"Upload your data",{"type":49,"value":137}," — provide a CSV or Excel file with at least three numeric columns that represent the components. They should sum to approximately 100 (percentages) or 1 (fractions) per row. A label column (country, sample ID, product name) is recommended.",{"type":43,"tag":128,"props":139,"children":140},{},[141,146,148],{"type":43,"tag":58,"props":142,"children":143},{},[144],{"type":49,"value":145},"Describe the plot",{"type":49,"value":147}," — e.g. ",{"type":43,"tag":149,"props":150,"children":151},"em",{},[152],{"type":49,"value":153},"\"ternary plot of fossil/nuclear/renewable electricity share by country, color by continent, label France and Norway\"",{"type":43,"tag":128,"props":155,"children":156},{},[157,162,164,171],{"type":43,"tag":58,"props":158,"children":159},{},[160],{"type":49,"value":161},"Get the visualization",{"type":49,"value":163}," — the AI writes Python code using ",{"type":43,"tag":165,"props":166,"children":168},"a",{"href":167},"https://plotly.com/python/ternary-plots/",[169],{"type":49,"value":170},"Plotly",{"type":49,"value":172}," to render the triangle chart with labeled axes and color-coded points",{"type":43,"tag":44,"props":174,"children":176},{"id":175},"required-data-format",[177],{"type":49,"value":178},"Required Data Format",{"type":43,"tag":180,"props":181,"children":182},"table",{},[183,207],{"type":43,"tag":184,"props":185,"children":186},"thead",{},[187],{"type":43,"tag":188,"props":189,"children":190},"tr",{},[191,197,202],{"type":43,"tag":192,"props":193,"children":194},"th",{},[195],{"type":49,"value":196},"Column",{"type":43,"tag":192,"props":198,"children":199},{},[200],{"type":49,"value":201},"Description",{"type":43,"tag":192,"props":203,"children":204},{},[205],{"type":49,"value":206},"Example",{"type":43,"tag":208,"props":209,"children":210},"tbody",{},[211,247,271,295],{"type":43,"tag":188,"props":212,"children":213},{},[214,225,230],{"type":43,"tag":215,"props":216,"children":217},"td",{},[218],{"type":43,"tag":219,"props":220,"children":222},"code",{"className":221},[],[223],{"type":49,"value":224},"label",{"type":43,"tag":215,"props":226,"children":227},{},[228],{"type":49,"value":229},"Row identifier",{"type":43,"tag":215,"props":231,"children":232},{},[233,239,241],{"type":43,"tag":219,"props":234,"children":236},{"className":235},[],[237],{"type":49,"value":238},"France",{"type":49,"value":240},", ",{"type":43,"tag":219,"props":242,"children":244},{"className":243},[],[245],{"type":49,"value":246},"Sample_A",{"type":43,"tag":188,"props":248,"children":249},{},[250,255,260],{"type":43,"tag":215,"props":251,"children":252},{},[253],{"type":49,"value":254},"Component A",{"type":43,"tag":215,"props":256,"children":257},{},[258],{"type":49,"value":259},"Share of first component",{"type":43,"tag":215,"props":261,"children":262},{},[263,269],{"type":43,"tag":219,"props":264,"children":266},{"className":265},[],[267],{"type":49,"value":268},"71",{"type":49,"value":270}," (nuclear %)",{"type":43,"tag":188,"props":272,"children":273},{},[274,279,284],{"type":43,"tag":215,"props":275,"children":276},{},[277],{"type":49,"value":278},"Component B",{"type":43,"tag":215,"props":280,"children":281},{},[282],{"type":49,"value":283},"Share of second component",{"type":43,"tag":215,"props":285,"children":286},{},[287,293],{"type":43,"tag":219,"props":288,"children":290},{"className":289},[],[291],{"type":49,"value":292},"10",{"type":49,"value":294}," (fossil %)",{"type":43,"tag":188,"props":296,"children":297},{},[298,303,308],{"type":43,"tag":215,"props":299,"children":300},{},[301],{"type":49,"value":302},"Component C",{"type":43,"tag":215,"props":304,"children":305},{},[306],{"type":49,"value":307},"Share of third component",{"type":43,"tag":215,"props":309,"children":310},{},[311,317],{"type":43,"tag":219,"props":312,"children":314},{"className":313},[],[315],{"type":49,"value":316},"19",{"type":49,"value":318}," (renewable %)",{"type":43,"tag":52,"props":320,"children":321},{},[322,324,329],{"type":49,"value":323},"The three component columns must sum to ~100 (or ~1). If they don't, ask the AI to normalize them: ",{"type":43,"tag":149,"props":325,"children":326},{},[327],{"type":49,"value":328},"\"normalize each row so the three components sum to 100%\"",{"type":49,"value":330},".",{"type":43,"tag":44,"props":332,"children":334},{"id":333},"interpreting-the-results",[335],{"type":49,"value":336},"Interpreting the Results",{"type":43,"tag":180,"props":338,"children":339},{},[340,356],{"type":43,"tag":184,"props":341,"children":342},{},[343],{"type":43,"tag":188,"props":344,"children":345},{},[346,351],{"type":43,"tag":192,"props":347,"children":348},{},[349],{"type":49,"value":350},"Position",{"type":43,"tag":192,"props":352,"children":353},{},[354],{"type":49,"value":355},"What it means",{"type":43,"tag":208,"props":357,"children":358},{},[359,375,391,407,423],{"type":43,"tag":188,"props":360,"children":361},{},[362,370],{"type":43,"tag":215,"props":363,"children":364},{},[365],{"type":43,"tag":58,"props":366,"children":367},{},[368],{"type":49,"value":369},"Near a vertex",{"type":43,"tag":215,"props":371,"children":372},{},[373],{"type":49,"value":374},"Dominated by that component (close to 100% of it)",{"type":43,"tag":188,"props":376,"children":377},{},[378,386],{"type":43,"tag":215,"props":379,"children":380},{},[381],{"type":43,"tag":58,"props":382,"children":383},{},[384],{"type":49,"value":385},"Near the center",{"type":43,"tag":215,"props":387,"children":388},{},[389],{"type":49,"value":390},"Roughly equal mix of all three components",{"type":43,"tag":188,"props":392,"children":393},{},[394,402],{"type":43,"tag":215,"props":395,"children":396},{},[397],{"type":43,"tag":58,"props":398,"children":399},{},[400],{"type":49,"value":401},"Near an edge",{"type":43,"tag":215,"props":403,"children":404},{},[405],{"type":49,"value":406},"Two-component mixture — the opposite component is near zero",{"type":43,"tag":188,"props":408,"children":409},{},[410,418],{"type":43,"tag":215,"props":411,"children":412},{},[413],{"type":43,"tag":58,"props":414,"children":415},{},[416],{"type":49,"value":417},"Cluster of points",{"type":43,"tag":215,"props":419,"children":420},{},[421],{"type":49,"value":422},"Group of observations with similar compositional profiles",{"type":43,"tag":188,"props":424,"children":425},{},[426,434],{"type":43,"tag":215,"props":427,"children":428},{},[429],{"type":43,"tag":58,"props":430,"children":431},{},[432],{"type":49,"value":433},"Point far from all clusters",{"type":43,"tag":215,"props":435,"children":436},{},[437],{"type":49,"value":438},"Outlier — unusual composition relative to the rest of the dataset",{"type":43,"tag":44,"props":440,"children":442},{"id":441},"example-prompts",[443],{"type":49,"value":444},"Example Prompts",{"type":43,"tag":180,"props":446,"children":447},{},[448,464],{"type":43,"tag":184,"props":449,"children":450},{},[451],{"type":43,"tag":188,"props":452,"children":453},{},[454,459],{"type":43,"tag":192,"props":455,"children":456},{},[457],{"type":49,"value":458},"Scenario",{"type":43,"tag":192,"props":460,"children":461},{},[462],{"type":49,"value":463},"What to type",{"type":43,"tag":208,"props":465,"children":466},{},[467,484,501,518,535],{"type":43,"tag":188,"props":468,"children":469},{},[470,475],{"type":43,"tag":215,"props":471,"children":472},{},[473],{"type":49,"value":474},"Energy policy",{"type":43,"tag":215,"props":476,"children":477},{},[478],{"type":43,"tag":219,"props":479,"children":481},{"className":480},[],[482],{"type":49,"value":483},"ternary plot of fossil/nuclear/renewable electricity share, color by region",{"type":43,"tag":188,"props":485,"children":486},{},[487,492],{"type":43,"tag":215,"props":488,"children":489},{},[490],{"type":49,"value":491},"Soil science",{"type":43,"tag":215,"props":493,"children":494},{},[495],{"type":43,"tag":219,"props":496,"children":498},{"className":497},[],[499],{"type":49,"value":500},"ternary plot of sand/silt/clay content, color by soil classification",{"type":43,"tag":188,"props":502,"children":503},{},[504,509],{"type":43,"tag":215,"props":505,"children":506},{},[507],{"type":49,"value":508},"Food nutrition",{"type":43,"tag":215,"props":510,"children":511},{},[512],{"type":43,"tag":219,"props":513,"children":515},{"className":514},[],[516],{"type":49,"value":517},"ternary plot of protein/fat/carbohydrate share, label each food category",{"type":43,"tag":188,"props":519,"children":520},{},[521,526],{"type":43,"tag":215,"props":522,"children":523},{},[524],{"type":49,"value":525},"Workforce structure",{"type":43,"tag":215,"props":527,"children":528},{},[529],{"type":43,"tag":219,"props":530,"children":532},{"className":531},[],[533],{"type":49,"value":534},"ternary plot of agriculture/industry/services employment, size by GDP",{"type":43,"tag":188,"props":536,"children":537},{},[538,543],{"type":43,"tag":215,"props":539,"children":540},{},[541],{"type":49,"value":542},"Portfolio allocation",{"type":43,"tag":215,"props":544,"children":545},{},[546],{"type":43,"tag":219,"props":547,"children":549},{"className":548},[],[550],{"type":49,"value":551},"ternary plot of equity/bonds/cash allocation by fund, color by risk rating",{"type":43,"tag":44,"props":553,"children":555},{"id":554},"related-tools",[556],{"type":49,"value":557},"Related Tools",{"type":43,"tag":52,"props":559,"children":560},{},[561,563,569,571,577,579,585],{"type":49,"value":562},"Use the ",{"type":43,"tag":165,"props":564,"children":566},{"href":565},"/tools/ai-scatter-chart-generator",[567],{"type":49,"value":568},"AI Scatter Chart Generator",{"type":49,"value":570}," when your data has only two components or when both axes are fully independent. Use the ",{"type":43,"tag":165,"props":572,"children":574},{"href":573},"/tools/ai-pie-chart-generator",[575],{"type":49,"value":576},"AI Pie Chart Generator",{"type":49,"value":578}," to show one row's composition as a proportion chart. Use the ",{"type":43,"tag":165,"props":580,"children":582},{"href":581},"/tools/ai-heatmap",[583],{"type":49,"value":584},"AI Heatmap Generator",{"type":49,"value":586}," to compare many compositional rows across many components (more than three).",{"type":43,"tag":44,"props":588,"children":590},{"id":589},"frequently-asked-questions",[591],{"type":49,"value":592},"Frequently Asked Questions",{"type":43,"tag":52,"props":594,"children":595},{},[596,601,603,608],{"type":43,"tag":58,"props":597,"children":598},{},[599],{"type":49,"value":600},"My three columns don't sum exactly to 100 — is that a problem?",{"type":49,"value":602},"\nSmall rounding differences (e.g. 99.8% or 100.2%) are fine. If your data sums to a different total (e.g. absolute values rather than percentages), ask the AI to normalize: ",{"type":43,"tag":149,"props":604,"children":605},{},[606],{"type":49,"value":607},"\"divide each row by its row sum before plotting\"",{"type":49,"value":330},{"type":43,"tag":52,"props":610,"children":611},{},[612,617,619,624,626,631],{"type":43,"tag":58,"props":613,"children":614},{},[615],{"type":49,"value":616},"Can I show contour lines or density regions on the ternary plot?",{"type":49,"value":618},"\nYes — ask for a ",{"type":43,"tag":149,"props":620,"children":621},{},[622],{"type":49,"value":623},"\"ternary contour plot\"",{"type":49,"value":625}," or ",{"type":43,"tag":149,"props":627,"children":628},{},[629],{"type":49,"value":630},"\"add density contours\"",{"type":49,"value":632},". The AI will use kernel density estimation projected onto the ternary coordinates to add iso-density curves, which helps when points overlap heavily.",{"type":43,"tag":52,"props":634,"children":635},{},[636,641,643,656],{"type":43,"tag":58,"props":637,"children":638},{},[639],{"type":49,"value":640},"Can I color points by a fourth variable?",{"type":49,"value":642},"\nYes — ask to ",{"type":43,"tag":149,"props":644,"children":645},{},[646,648,654],{"type":49,"value":647},"\"color points by ",{"type":43,"tag":649,"props":650,"children":651},"span",{},[652],{"type":49,"value":653},"column name",{"type":49,"value":655}," using a color scale\"",{"type":49,"value":657},". The AI will map a continuous or categorical fourth variable to point color while preserving the three ternary coordinates.",{"type":43,"tag":52,"props":659,"children":660},{},[661,666],{"type":43,"tag":58,"props":662,"children":663},{},[664],{"type":49,"value":665},"What if I have more than three components?",{"type":49,"value":667},"\nYou'll need to collapse them into three groups first. For example, if you have six energy sources, group them into fossil / nuclear / renewable. Describe the grouping in your prompt and the AI will aggregate the columns before plotting.",{"title":7,"searchDepth":669,"depth":669,"links":670},2,[671,672,673,674,675,676,677],{"id":46,"depth":669,"text":50},{"id":119,"depth":669,"text":122},{"id":175,"depth":669,"text":178},{"id":333,"depth":669,"text":336},{"id":441,"depth":669,"text":444},{"id":554,"depth":669,"text":557},{"id":589,"depth":669,"text":592},"markdown","content:tools:015.ternary-plot.md","content","tools/015.ternary-plot.md","tools/015.ternary-plot","md",{"loc":4},1775502471196]