On 09/09/2012 04:50 PM, sfeam (Ethan Merritt) wrote:
> On Sunday, 09 September 2012, Daniel J Sebald wrote:
>> This morning I came to wonder, What if one wants one end of the range
>> fixed while the other is autoscaled? So I tried a few things, and the
>> results certainly aren't intuitive, or are buggy.
>>
>> Say, for example, my intention is to make a plot for which the left side
>> starts at x=30 and is autoscaled on the right side. I try
>>
>> gnuplot> plot [30:*] x
>>
>> and get something very unexpected, unless I really think about it.
>
> Autoscaling doesn't have an obvious meaning for function plots.
> Normally that command would be followed by 'plot<datafile>', with
> the meaning that points with x<30 would not be plotted.
>
>> First, the result is reversed, slightly unexpected. Then I wonder, 10
>> is the "upper" range? OK, now I see. If I were to "plot x", the lower
>> range is 0 and upper range 10 by definition.
>
> Not quite. The default range for function plots is [-10:10]
>
>> So that is where the
>> reverse axis is coming from. That means if one does
>>
>> gnuplot> plot [3:*] x
>>
>> it comes out non-reversed. And yes that is the result. OK, perhaps
>> gnuplot should be changed so that the upper limit is "rangemin + 10",
>> and the symmetric case "rangemax - 10".
>>
>> Out of curiosity I try
>>
>> gnuplot> set xrange [3:*] reverse
>> gnuplot> plot x
>>
>> and the graph changes. However,
>>
>> gnuplot> set xrange [30:*] noreverse
>> gnuplot> plot x
>> gnuplot> set xrange [30:*] reverse
>> gnuplot> plot x
>>
>> brings no change in the graph. Perhaps that is just a ramification of
>> the "rangemin + 10" issue.
>>
>> So, I wonder how I can get better control of the range settings and
>> achieve the initial goal of left end of plot fixed at thirty and the
>> right end autoadjust. How about
>>
>> gnuplot> plot [30:40<*] x
>
> None of the above test commands make sense, IMHO.
> Function plots require a complete range specifier.
> I'd be in favor of giving an error message in each of those cases.
> That is, disallow '*' in the range specifier for function plots.
gnuplot has always sought to make as much sense out of a command as
possible and try plotting something. The following is default behavior:
gnuplot> plot [*:*] x
gnuplot> plot [*:*] '-'
input data ('e' ends) > 1 1
input data ('e' ends) > 2 1
input data ('e' ends) > e
Warning: empty y range [1:1], adjusting to [0.99:1.01]
How can one say the default range specifier makes any more sense than
does [30:*]?
> <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>
Yes, I sort of agree with that. That is why I picked the phrasing that
the range is associated with the data, not the orientation of the axis.
Given the example you wrote, the paradigm is that [10:20] means the
data for which x is between 10 and 20, and in that case [20:10] is no
different than [10:20]. Using the range specifier to control the
orientation of the plot in your example would be a mess.
>> I would think that "reverse" could
>> be viewed as "do all the range computations, then when all done reverse
>> the range".
>
> That is indeed what it now means. At least that's the intent.
> Do you have an example that works otherwise?
Well, the change in 4.7 doesn't mean that anymore. The following
produce the same graph:
gnuplot> set xrange [30:50]
gnuplot> plot x
gnuplot> set xrange [30:50] reverse
gnuplot> plot x
Those of us familiar with range specifier history aren't that confused
by this. But someone using gnuplot for the first time will by
befuddled. In one case the user needs to use the term "reverse" to
change the orientation, in another case the user needs to change the
order of the numbers in the range specifier.
There were sort of three small changes made here:
1) "reverse" no longer has an effect on the range specification, i.e.,
specifying "[30:50] reverse" doesn't peculiarly change the specification
to "[50:30]"
2) The range specification no longer toggles the "{no}reverse" option so
that it gets stuck.
3) "reverse" only applies to the autoadjust settings.
1 and 2 I'm happy to see, but I would also add that with those changes
it seems to me that the range specification numbers and "reverse" are
decoupled. Why shouldn't one be allowed to input:
gnuplot> set xrange reverse
^
expecting '[' or 'restore'
on its own?
Anyway, the most affect on backward compatibility is 3 above, so I'm
wondering why that change is preferred. One could argue that
set [*:*] reverse
would otherwise still stick "reverse". However, the user now has to
intentionally changed the setting rather than it happening as a
consequence of the range specification.
>> In any case, I have a patch all set for Octave to address the proposed
>> mod in 4.7 beta, but I'm reluctant to apply it until 4.7 becomes an
>> official release. Perhaps we could address the bugs I described above
>> with the current proposed 4.7 behavior in mind and then reassess how
>> one-side-autoadjust works. That is, fix things so that:
>>
>> [a:*] - The autoadjust value * is greater than a
>> [*:b] - The autoadjust value * is less than b
>
> That's what it does now in 4.7, at least for me.
> Again, do you have an example of data-driven autoscaling that
> gives some other result?
OK, I'm going to just try a few plots here:
gnuplot> reset
gnuplot> plot [10:*] '-', x
input data ('e' ends) > 5 5
input data ('e' ends) > 8 8
input data ('e' ends) > 12 12
input data ('e' ends) > 15 15
input data ('e' ends) > e
gnuplot> show xrange
set xrange [ * : * ] noreverse nowriteback # (currently
[10.0000:15.0000] )
LOOKS GOOD...
gnuplot> plot [*:10] '-', x
input data ('e' ends) > 5 5
input data ('e' ends) > 8 8
input data ('e' ends) > 12 12
input data ('e' ends) > 15 15
input data ('e' ends) > e
gnuplot> show xrange
set xrange [ * : * ] noreverse nowriteback # (currently
[5.00000:10.0000] )
LOOKS GOOD...
gnuplot> set xrange [10:*] reverse
gnuplot> plot '-', x
input data ('e' ends) > 5 5
input data ('e' ends) > 8 8
input data ('e' ends) > 12 12
input data ('e' ends) > 15 15
input data ('e' ends) > e
gnuplot> show xrange
set xrange [ 10.0000 : * ] reverse nowriteback # (currently [:10.0000] )
THE PLOT LOOKS GOOD, BUT I WONDER WHY "currently" DOESN'T SAY
"[15.0000:10.0000]" OR "[10.0000:15.0000] reverse"...
gnuplot> set xrange [*:10] reverse
gnuplot> plot '-', x
input data ('e' ends) > 5 5
input data ('e' ends) > 8 8
input data ('e' ends) > 12 12
input data ('e' ends) > 15 15
input data ('e' ends) > e
gnuplot> show xrange
set xrange [ * : 10.0000 ] reverse nowriteback # (currently [10.0000:] )
AGAIN, PLOT IS AS EXPECTED BUT THE "currently" IS INCOMPLETE WHERE I
THINK IT SHOULD SAY "[10.0000:5.0000]".
Dan
|