plotly add path line work but arc not take effect

I try below code to add a arc between two line.

    path = """M0,0
    H100
    A20 20 0 0 1 20 20
    V100

The line works but the arc not work.
enter image description here

full code:

import plotly.graph_objs as go
def save_fig(fig,pngname):
    fig.write_image(pngname,format="png", width=800, height=600, scale=1)
    print("[[%s]]"%pngname)
    #fig.show()
    return

def plot(pngname):
    title="demo"
    xlabel="x"
    ylabel="y"

    xrange = [-10,110]
    yrange= [-10,110]
    
    fig = go.Figure()
    
    add_path(fig)
    fig.update_layout(
        margin=dict(l=10,t=40,r=10,b=40),
        plot_bgcolor="#ffffff",#'rgb(12,163,135)',
        paper_bgcolor="#ffffff",        
        title=title,
        xaxis_title=xlabel,
        yaxis_title=ylabel,
        title_x=0.5,
        barmode="group",
        bargap=0.05,
        bargroupgap=0.0,
        legend=dict(x=.02,y=1),
        font=dict(
            family="Courier New, monospace",
            size=12,
            color="black"
        ),
        xaxis=dict(
            range=xrange,
            #autorange="reversed",
            tickangle=-25,            
            showline=True,
            linecolor="black",
            color="black",
            linewidth=.5,
            ticks="outside",
            #mirror=True,
        ),
        yaxis=dict(
            range=yrange,
            #dtick=10,
            showline=True,
            linecolor="black",
            color="black",
            linewidth=.5,            
            #tickvals = yvals,
            #ticktext= ytexts,      
            showgrid=True,
            gridcolor="grey",#'#ececec',
            gridwidth=.5,
            griddash="solid",#'dot',
            zeroline=True,
            zerolinecolor="grey",
            zerolinewidth=.5,
            showticklabels=True,
            #mirror=True,
        ),        
    )
    save_fig(fig,pngname)    
    return

def add_path(fig):
    lw = 4
    path = """M0,0
    H100
    A20 20 0 0 1 20 20
    V100
    """
    
    fig.add_shape(
        dict(
            type="path",
            path=path,
            xref="x", yref="y",
            line=dict(
                color="red",
                width=lw,
            ),
        )
    )
    return

sdir = "/media/sf_work"
def main():
    plot(sdir + "/demo.png")
    return

main()

Leave a Comment