Python plot command for any editor?

Hi there

As I understood and searched, approximately for any python editor we need a command to do the plot. for example, for jupyter notebook we need a special command and for VScode we need another one and for spyder we need something else. I have written a python package that its users use different editors. is there a command that works for all editors?

I’d presume you’re talking about fig.show() function for displaying the figure inside the various programs?

From what I understand there isn’t a one size fits all for that part.

What I don’t grasp is why do you have various users directly running the code with different software if they are unable to modify a single line of code? Are these end users you’re taking about or other developers?

If it’s end users you should not be deploying anything that way. It’s a recipe for disaster giving a user direct access to code while having no clue what they should do with it.

Thanks
Payton

Edit: I see you’ve posted in a few other old threads can you post some bits of your code? I think you’re using ipywidget to render the graphs?

The question is what is the end goal. Do you have some users at a company who are just trying to view the final results you create?

If so you can write the figures to HTML pages and save those, then the end user just double clicks the file to open in their local web browser.
Or you can deploy it as a webapp with dash/flask and the user would go to a website to view the page.

If it’s something else can you explain further? And some snippits of your code would help.

3 Likes

Dear @payton-dev

Really thanks for your contribution on this post. I’m sure you are a professional and your question comes from your deep understanding of Plotly and the role of developers and end users. So, I have to explain more about why we need such condition and why I’m searching for it, and I will explain how I solved it in somehow to know your idea about this solution.

I’m Ph.D. student in civil engineering field and all of members that I’m in connection are in this field too. There is a great open-source program for Structural engineers that its name is OpenSees and this is more that 20 years that Structural engineers are working on this program. (GitHub - OpenSees/OpenSees: OpenSees Source Code Repository)
Most of the engineers are not expert on coding and programming and they have to use coding because the OpenSees is according to codes and so, they start writing code to handle what they need in this program. Someone starts in Jupyter, some others start in Spyder and some others on VsCode and recently some new members are working in Pycharm and … .

Using Plotly I have provided a small package to plot the model and now you can understand why many of engineers starts nagging why it is not working on Spyder or Pycharm or … and when I tell them move on Jupyter then again, they start nagging to please solve it for …

This is the reason that I’m trying to do the plot for any platforms.

(Sorry for my weak English)

To solve the problem Currently I have put an option to the provided function and call it plotmode and users can select a value between 1 to 6 and by each selection a plot condition will be activate: For example: Figure or ipywidgetFigure and plot or show or iplot or display. Also, I’m not perfect in Plotly deep problems and I’m an ordinary user of it.

I hope that you understand what I said.