title: Cannot position plotly legend outside plot borders
body: <p>I have a plotly graph that uses the Dash library to manipulate the x-values on the plot for simple comparison. When x values, in this case countries, is greater than 1, the legend is properly positioned outside of the graph. However, when there is only one country on the plot, the legend covers half of the plot.</p>
  <p>I have tried: setting the legend x attribute to 3, x anchor to right, and changing the graph margin to add padding. I haven't found a solution that works.</p>
  <p>Below is the section of the code that updates the plotly fig.</p>
  <pre><code>   window_width = 1500
          fig = px.bar(data_frame=dfi5.loc[(value_country)], width=(window_width / 4) * len(value_country))
          fig.update_xaxes(showticklabels=True, title='')
          fig.update_yaxes(showticklabels=True, title='Percent of Respondents')
          fig.update_layout(autosize=False, title_text='Favorite K-Drama by Country', title_x=.46, title_font_size=20,
                            legend_title_text='Drama Title', margin_r=1, legend_xanchor='right', legend_x=3, legend_itemsizing='constant')
  </code></pre>
  <p><a href="https://i.stack.imgur.com/M700S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M700S.png" alt="Plot with one country" /></a></p>
  <p><a href="https://i.stack.imgur.com/Oy1d6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Oy1d6.png" alt="Plot with greater than one country" /></a></p>
  <p><strong>Update:</strong> I was able to find a workaround by reducing the legend font size, which reduces the area of the legend. I would be interested to learn if there is a way to explicitly set the location of the legend. The issue seems to occur when the legend area is wider than the plot area.</p>