Matthias Michler wrote:
> Hello Eric, Hello list,
> 
> a year ago I also encountered the problem of "one file - one figure" of the 
> plotfile function. I would like to propose an addional functionality of using 
> one figure and several files in plotfile, because sometimes I don't want to 
> read data myself. I added a patch including the following changes:
> - added a new keywordargument to plotfile 'use_cf': If use_cf isTrue plotfile 
> uses fig = gcf() instead of fig = figure() to suppress opening of a new 
> figure and therewith allowing to use the user preferred figure
> - added a further new keyword argument 'names' to set x/ylabels in the case 
> there are no names in the csv-file
> 
> Furthermore I attached the modified plotfile_demo.py 
> (examples/pylab_examples/plotfile_demo.py) and some new data 
> (examples/data/data_x_x2_x3.csv).
> 
> Could this be useful?
> 
> Thanks in advance for any comments.

Matthias,

I incorporated a slight modification of your changes (newfig=False 
instead of use_cf=True) together with changes I made to directly support 
what Joseph asked about.  The result is in r7078.

I hesitated to make even these changes, though, because I think we 
should avoid trying to make plotfile into a do-all tool.  It should be 
kept as something that may be handy for quick and dirty plotting in some 
situations; but when a user needs something beyond that, the better 
approach is for the user to simply use the pyplot or matplotlib API to 
achieve the desired result directly.

Eric

> 
> best regards
> Matthias
> 
> On Wednesday 29 April 2009 09:20:17 Eric Firing wrote:
>> Joseph Smidt wrote:
>>> Okay, I am another gnuplot user trying to migrate over to matplotlib.
>>> I like what I see, but there are a couple things that are very easy to
>>> do in Gnuplot that I can't figure out how to do with matplotlib.
>>>
>>> I have a file with 3 columns of data called data.txt that looks like:
>>>
>>> 0.0000      1.0000     1.0
>>> 0.0634      1.0655      1.1353
>>> 0.1269      1.1353      1.28899916094
>>> 0.1903      1.2097      1.46345358199
>>> 0.2538      1.2889     1.6615188369
>>> 0.3173      1.3734     1.88639043926
>>> ...
>>>
>>> I can plot this data, 2 versus 1 and 3 versus 1, very easily on the
>>> same plot, with a legend, with log y values, and only for the xrange
>>> between 2 and 3 with gnuplot:
>>>
>>> set log y
>>> set xrange[2:3]
>>> plot 'data.txt' u 1:2 w l t 'apples', 'data.txt' u 1:3 w l t 'oranges'
>>>
>>> Now, how do I do that same thing with matplotlob?  Ie:
>>>
>>> 1. Both graphs overlayed on the same plot.
>>> 2. Semilogy. (log y values),
>>> 3. Only ploy for x in the range 2-3.
>>> 4. Legend for the two graphs on same plot.
>> Something like this:
>>
>> import numpy as np
>> import matplotlib.pyplot as plt
>>
>> x, apples, oranges = np.loadtxt('data.txt', unpack=True)
>> plt.semilogy(x, apples, label='apples')
>> plt.semilogy(x, oranges, label='oranges')
>> plt.legend()
>> plt.gca().set_xlim(2, 3)
>> plt.show()
>>
>> There are many possible variations and styles.  The basic point is to
>> separate reading in the data from plotting it.  Plotfile won't do what
>> you want because it is designed to make separate subplots instead of
>> plotting multiple lines on a single axes.  Maybe doing the latter would
>> be at least as useful, if not more, and could be enabled as an option
>> with one more kwarg.
>>
>> Eric
>>
>>> I have spent time looking through the documentation but I can't find
>>> anyway to do this is any straightforward way.  plotfile() looks
>>> promising, but I can't seem to make it do the above.  Thanks in
>>> advance.
>>>
>>>                              Joseph Smidt
>> ---------------------------------------------------------------------------
>> --- Register Now & Save for Velocity, the Web Performance & Operations
>> Conference from O'Reilly Media. Velocity features a full day of
>> expert-led, hands-on workshops and two days of sessions from industry
>> leaders in dedicated Performance & Operations tracks. Use code vel09scf
>> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 


------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to