|
From: hari j. <ha...@gm...> - 2012-10-16 15:26:01
|
Hi
I am a relative newbie to matplotlib.
I have a python script that handles a dataset that comprises 384 sets of
data.
At the present moment , I read in a set of data - process it - and the
create a figure using code shown below.
I am using windows with the default backend ( I think I set it to wx).
When I run the program, figure after figure shows up..the program continues
from well to well plotting the figure. I can close the figure window using
the X on the right -hand side..while the program chugs along.
Is there a way to just recycle the figure object , so that the plot shows
up for a brief second and refreshes when the next calculation is complete.
Each process_data function , takes a few minutes.
Alternatively I just want to close the figure object I show after a brief
lag. I am OK if that happens instantaneously..but I dont know how
to achieve this.
Do I have to use the matplotlib.Figure object to achieve this functionality
Thanks
Hari
from matplotlib.pyplot import figure
def do_my_plot(well_id):
processed_data_object = processed_dict[well_id]
fig = figure(figsize=(7,7)
ax = fig.add_subplot(1,1,1)
par1 =ax.twinx()
par2 = ax.twinx()
# Plot all the data
par1.plot(processed_data_object.raw_x,processed_data_object.raw_y).
par2.plot(....
# finally
fig.show()
# I tried fig.clf()
def plot_and_process_data():
for well_id in list_of_384_well_ids:
process_data(well_id)
do_my_plot(well_id)
|