|
From: sfeam (E. Merritt) <eam...@gm...> - 2012-11-18 04:13:31
|
On Monday, 10 September 2012, Tait <gnu...@t4...> wrote: > > "sfeam (Ethan Merritt)" <sf...@us...> > > >>> <aside> > > >>> As you probably recall, my opinion is that a range specifier in the plot > > >>> command is always a bad idea. If it were just me, I'd remove that option > > >>> altogether. The only reason I can see to allow it is if it is changed so > > >>> that the in-line range applies only to the immediately following plot clause. > > >>> That way you could get separate ranges for separate plots: > > >>> plot [10:20] f1(x), [20:30] f2(x), [30:100] f3(x) > > >>> I don't really like that either, but at least it would provide a > > >>> capability that isn't addressed by simply doing "set xrange" first. > > >>> </aside> > I like the idea of separating axis range from (data/function) plot range. > It's a somewhat frequently-asked question how to use a different range for > a function than what is used for the axis, and the current solution -- to > use a ternary -- isn't especially elegant. I've put a patchset on SourceForge that implements this idea. https://sourceforge.net/tracker/?func=detail&aid=3587664&group_id=2055&atid=302055 Its documentation says: + By default, computed functions or data generated for the pseudo-file "+" are + sampled over the entire range of the plot. This range may have been specified + by a prior `set xrange` command, by an explicit global range specifier at the + very start of the plot command, or by autoscaling of the range to span data + seen in all the elements of this plot command. However, individual plot + elements can be assigned a more restricted sampling range. + + Examples: + + This establishes a total range on x running from 0 to 1000 and then plots + data from a file and two functions each spanning a portion of the total range: + plot [0:1000] 'datafile', [0:200] func1(x), [200:500] func2(x) + + This is similar except that the total range is established by the contents + of the data file. In this case the sampled functions may or may not be + entirely contained in the plot: + set autoscale x + plot 'datafile', [0:200] func1(x), [200:500] func2(x) + + This command is ambiguous. The initial range will be interpreted as applying to + the entire plot, not solely to the sampling of the first function as was + probably the intent: + plot [0:10] f(x), [10:20] g(x), [20:30] h(x) + + This command removes the ambiguity of the previous example by inserting a dummy + definition so that the range is not the first element of the plot command: + plot dummy=0, [0:10] f(x), [10:20] g(x), [20:30] h(x) |