skip to Main Content

Is it possible to set the width of the graph and the width of the legend separately?

Because "width" in the layout set the width for all plot.

I want to have the next behavior, graph always has the 80% of width and legend the rest 20%.
enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    The only thing that helps me for now, is to add x value for the legend:

     legend: {
              x: 1.3,
              xanchor: "right"
        }
    

  2. The Plotly layout docs give many different options for customizing the layout of your graph.

    // entrywidth is a fraction, so 0.2 would be 20%. entrywidthmode specifies that entrywidth is a fraction, not pixels.
    layout={{width: 320, height: 240, legend: {entrywidth: 0.2, entrywidthmode: "fraction"}}}
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search