I haven't been using the pan and zoom stuff very much,
> the issues I described this week are all from initial
> plots. If I had been doing more zooming then I would have
> noticed your very good point about jumping ticks being
> distracting. It's fiddly stuff, but getting it right
> helps a lot when interpreting results from plots!
OK, I think my approach will be to optimize the number of ticks, tick
locations and view limits on the initial plot and then fix num ticks
for interactive mode (pan/zoom). Ie, the initial guess should be
good, but with interaction, you're on your own. I'll send you some
code when I get this figured out.
>> Ie, ignore the end point is the default behavior of python.
> I guessed as much. But I think in this case the python
> behaviour needs to be over-ridden. Python range logic is
> generally about integers, arange stretches it, and using
> this [) style range for plots over-stretches the
> principle beyond usefulness. There are also a couple of
> contradictions in matplotlib's behaviour:
Yes, but I can defend myself! From the first line of the homepage
matplotlib is a pure python 2D plotting library with a Matlab
Ie, matplotlib does contain inherent contradictions because it is both
matlab-like and python-like. matlab has FORTRAN style indexing
(starts with 1) and python has C style indexing (starts with 0). So
the first matplotlib figure starts with figure(1). When using the
matlab interface matplotlib.matlab, I strive for matlab compatibility.
Thus, when you set the axis limits with
axis([0, 2, -1, -1])
set(gca(), 'xlim', [0, 2])
I do it like matlab does, ie, endpoints inclusive.
However, I plead innocence in the case of
t = arange(0.0, 2.0, 0.1)
s = sin(2*pi*t)
If the arrays t and s passed to the plot function do not have the
point at t=2.0 defined, "plot" can't guess them. I plot the points
you give me. Note that matplotlib *does* provide the matlab function
"linspace", which returns an evenly sampled array, endpoints included.
So if you want matlab-like behavior you should use matlab-like array
functions (linspace) rather Numeric python array functions (arange) to
define your arrays.
t = linspace(0.0, 2.0, 20)
s = sin(2*pi*t)
In a nutshell, with the matlab interface I try to be consistent with
matlab, but there are inconsistencies which arise by virtue of the
fact that it's natural to use python functions (thank god!, that's why
we're all here).
I definitely appreciate the criticism, so feel free to keep at it.