I have a question, not sure if its difficult or not, but i tried to google the answer. nothing worthy.
I have figure as global, which can be accessed in all threads.
but it appears in the beginning of the program,
I want to hide or making it invisible in the starting of the script then at one point in the code make it available or visible.
Is there is any Matplotlib like visible False or something
i use this:
plt.ion()
fig = plt.figure(visible=False)
ax =fig.add_subplot(111)
Thanks in advance
Use matplotlib. pyplot. close() to hide a figure from being shown.
Avoid Display With ioff() Method We can turn the interactive mode off using matplotlib. pyplot. ioff() methods. This prevents figure from being displayed.
To hide or remove X-axis labels, use set(xlabel=None). To display the figure, use show() method.
Right-click on a data plot and select Hide Data Plot or Hide Others from the shortcut menu. In the Plot Details dialog box, clear or check the box next to the data plot.
I have to do the same thing that you're asking for, but I put the figure on a canvas first using this process (NOTE: this uses matplotlib, pyplot, and wxPython):
#Define import and simplify how things are called
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
import matplotlib.pyplot as plt
#Make a panel
panel = wx.Panel(self)
#Make a figure
self.figure = plt.figure("Name")
#The "Name" is not necessary, but can be useful if you have lots of plots
#Make a canvas
self.canvas = FigureCanvas(panel, -1, self.figure)
#Then use
self.canvas.Show(True)
#or
self.canvas.Show(False)
#You can also check the state of the canvas using (probably with an if statement)
self.canvas.IsShown()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With