How to make Plotly chart web address NOT to change?

When I run a Python Plotly app which ends with fig.show() it creates a web page with a random address, like 127.0.0.1:53677. So if I put this Python Plotly app within a loop it will create (every time) a new browser window, with a different address, meaning endless number of windows.
My goal is to set this address to be the same, like 127.0.0.1:8050 with Dash, so the app will create the graph always within the same window, like real-time graph. How do I do that?
I use PyCharm, if that is important.

Hi,

I had a similar question a long time ago and I ended up convincing myself (perhaps wrongly) that there are no way to control the port from the API. What I did instead was to use plotly.io.to_html to convert the figure object to string and then used webbrowserto send it to the browser. This is basically what plotly does, but you have extra control.

Hope this helps!

Thanks, I had a look but I am sure there must be a simple solution, like in Dash. Let’s see if others have anything to say.

1 Like