On Tue, Oct 16, 2012 at 5:09 PM, Sterling Smith <smit...@fusion.gat.com> wrote:
> Hari,
>
> You can give a number to figure(), as in figure(1), and it will reuse figure 
> 1.  Also, you can close figure 1 with pyplot.close(1).
>
> -Sterling
>
> On Oct 16, 2012, at 8:25AM, hari jayaram wrote:
>
>> 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)

Or you can call ax.cla() to clear the axes before plotting the next
data set. Then subsequent calls to plot don't need 300+ figure
objects.

-- 
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to