Skip to content

Plot.Show is minimized after input command #29637

@samer1977

Description

@samer1977

Hi ,

I just begin to use this library so I have a lot to learn and I apologize if this turns to be false alarm or an old issue. I did research but nothing turned up.

The issue:

Im using matplotlib to create visuals using Python . The code is just simple python code that prompt user input through standard terminal in windows (console) which Im not sure if this is the right plaform for such library but in a simple example without prompting user input when I run the command plot.show() it works by opening matplotlib window showing the visual. However if I add line of code to ask for user input before calling the show() function as in :

input("Please press any key...")

the visual window will show minimized!

Example

The following code shows the behavior by removing\adding the input command

import matplotlib.pyplot as plt

#Remove or add the input statement to see the difference on how the window is showing up or showing minimized
input("Press any key to contiue...")
# Data for the pie chart
labels = ['Category A', 'Category B', 'Category C', 'Category D']
sizes = [25, 30, 20, 25]
colors = ['gold', 'yellowgreen', 'lightcoral', 'lightskyblue']
explode = (0, 0.1, 0, 0)  # explode the 2nd slice (i.e. 'Category B')

# Plot
plt.pie(sizes, explode=explode, labels=labels, colors=colors, autopct='%1.1f%%', shadow=True, startangle=140)

plt.axis('equal')  # Equal aspect ratio ensures that pie is drawn as a circle.
plt.title('Sample Pie Chart')
plt.show()

The ask:

How this can be mitigated?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions