mbaz/Gaston.jl — pull request #14 by carlobaldassi (2013-06-13 23:31:06+00:00)
Title: Add axes ranges options to high-level functions

This adds `xrange`, `yrange` and `zrange` to high-level functions.
I saw you accepted pull requests to fix #10, so here it is :)

My tests indicate this is fully functional and I think it's in good-enough-to-merge status, but here are a few technical points and notes:

* In order to fully support gnuplot's range syntax, particularly about autoscale, ranges are passed as `String` arguments. e.g. `plot(data, "yrange", "[5:*]")`. Extending it to accept `Range1` arguments would be straightforward, but it might get confusing, so I didn't do it for the time being.
* Ranges are checked (via a regex) for validity. The regex should be solid. At the moment, only "pure" ranges are accepted (e.g. `[3.4e-5:4 < * < 10]`) without modifiers (such as `reverse`); accepting them would just be a matter of allowing it in the regex (1 minute job), but I felt such modifiers might deserve their own option if included at all (e.g. `plot(data, "reversey")` or something along these lines) - or maybe it would just be a useless complication: opinions welcome
* At the moment, `set autoscale` is still invoked before setting the ranges, thereby making `[:]` and `[*:*]` act the same. I think this is sane, but I'm not 100% sure (maybe there should be an interaction with the default, if set, such that e.g. `[:5]` means "from default minimum to 5" and `[*:5]` means "from autoscaled minimum to 5").
* I have updated the documentation, but details are lacking (it just says "refer to gnuplot's docs"), mainly because explaining the whole syntax of gnuplot's ranges within a table cell seemed a little too much. Also, I didn't mention details such as not supporting modifiers while I waited to know your opinion.

Finally, a small note on my motivation for this: I found myself calling `histogram` from an algorithm at regular intervals, to have a visual feedback on the underlying dynamic process, and it works just great (it's a fantastic tool to tune parameters, understand what's going on etc., all by adding one line of code!); I wanted to stabilize the ranges though, so that plots (which get updated very quickly) are easily comparable to each other.