Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8244827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:59:17+00:00 2026-06-07T21:59:17+00:00

I am trying to have a plot pop up so the user can confirm

  • 0

I am trying to have a plot pop up so the user can confirm that a fitting worked, but not hang up the entire process doing so. However, while the window appears, there is never anything in it, and it is “Not Responding”. I suspect that there is a bad interaction with the subprocess functionality, as this code is front-ending and data processing for a simulation being run in C++.

import subprocess
import numpy as np
from matplotlib import pyplot as mpl
...
mpl.ion()
fig = mpl.figure()
ax = fig.add_subplot(1,1,1)
ax.grid(True)
ax.plot(x, y, 'g')
ax.scatter(X, Y, c='b')
ax.scatter(min_tilt, min_energy, c='r')
mpl.draw()
...
subprocess.call(prog)

The following subprocess does open. If I remove the ion() call and use mpl.show(), then the plot works fine, but the entire process holds up until the window is closed. I need the process to continue while the user looks at the graph. Is there a way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:59:19+00:00Added an answer on June 7, 2026 at 9:59 pm

    This is probably overkill, but since no one had any better solutions I went to the threading module and it worked. If anyone has a simpler way to do this, please let me know.

    import subprocess
    import threading
    from matplotlib import pyplot as mpl
    ...
    class Graph(threading.Thread):
       def __init__(self,X,Y,min_tilt, min_energy):
           self.X = X
           self.Y = Y
           self.min_tilt = min_tilt
           self.min_energy = min_energy
           threading.Thread.__init__(self)
    
       def run(self):
           X = self.X
           Y = self.Y
           dx = (X.max()-X.min())/30.0
           x = np.arange(X.min(),X.max()+dx,dx)
           y = quad(x,fit)
           fig = mpl.figure()
           ax = fig.add_subplot(1,1,1)
           ax.grid(True)
           ax.plot(x, y, 'g')
           ax.scatter(X, Y, c='b')
           ax.scatter(self.min_tilt, self.min_energy, c='r')
           mpl.show()
    thread = Graph(X,Y,min_tilt,min_energy)
    thread.start()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a plot (sample code pasted below) that I am trying to add
I have the following data set that I am trying to plot with ggplot2,
Has anyone managed to use core-plot from wax? I have been trying recently, but
I have a bunch of points that I am trying to plot using matplotlib.
I am trying to plot a graph using gnuplot. I have six text files.
I am trying to have a method that takes in a username and will
I have been trying to put together something that allows me to extract points
I have a a stacked bar plot using ggplot for which I'm trying to
I'm trying to understand how to have more than one series on a plot,
I have one y variable, which I am trying to plot against two related

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.