Skip to content

Markers are cut off at edge of ternary plot area #4414

@vaiotite

Description

@vaiotite

Some makers at edge of ternary plot area are cut off.
Wondering if it is possible that markers appear without cutting off.

#install packeges
import plotly.graph_objects as go
import plotly.express as px
from plotly.validators.scatter.marker import SymbolValidator
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

#input CSV data
df = pd.read_csv('Carbonate_100.csv', skiprows=1, index_col=None, names=('Type', '#Ca','#Mn','#Mg'))

# ternary plot by px
fig = px.scatter_ternary(df, 
                         a="#Ca",
                         b="#Mn", 
                         c="#Mg", 
                         color="Type",
                         symbol="Type")

#graph adjustment
fig.update_ternaries(sum=100,
                     aaxis_min=80,
                     baxis_min=0, 
                     caxis_min=0,
                     aaxis_title_font_size=24, aaxis_tickfont_size=16,
                     baxis_title_font_size=24, baxis_tickfont_size=16,
                     caxis_title_font_size=24, caxis_tickfont_size=16)
fig.update_traces(marker=dict(size=20,
                             opacity=0.5,
                             line=dict(width=1,color='#000000')))
fig.update_layout(legend=dict(xanchor="left",
                              yanchor="bottom",
                              x=0.25,
                              y=0.7,
                              orientation='v',
                              font_size=16,
                              bgcolor="white",
                              bordercolor="black",
                              borderwidth=1)
                 )                             
fig.update_layout(margin=dict(b=50,r=50),
                 xaxis_side="top", height=400, width=900)

Using the code above, I got such ternary plot.
Carbonate
Some markers on the edges appear to be partially missing. But, I'd like to display the entire markers.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions