|
From: John H. <jdh...@ac...> - 2004-02-25 18:18:31
|
>>>>> "James" == James Boyle <bo...@ll...> writes:
James> I set the axis bounds when I am plotting a number of lines
James> some of which have a larger domain. While interested in the
James> behaviour in the limited domain, I would like to retain the
James> information that some lines extend beyond. When I first
James> encountered this behaviour, I thought that I had mistakenly
James> truncated my input data - I think that the plot should show
James> as much of the data passed to it as possible.
James> Is there something I am missing - or is this a feature?
It's a feature!
matplotlib does two kinds of clipping: data clipping and viewport
clipping. Viewport clipping is the typical clipping where the lines
are clipped to the viewport. data clipping throws out all points not
in the viewport.
I work with very long data sets of which only a small portion is in
the viewport, and use the interactive navigation controls to scroll
trough it. I found it was much more efficient to first clip the data
with Numeric before plotting it. See examples/stock_demo.py, of which
only a few days of 60 days of data are initially in the viewport.
You can control this in a couple of ways:
from matplotlib.matlab import *
ax = subplot(111)
line1, line2 = plot([1,2,3,4],'bo', [1,2,3,4],'k')
line1.set_data_clipping(False)
line2.set_data_clipping(False)
axis([0.,2.4,1.,4.])
show()
Or edit the init function of lines.Line2D to turn data clipping off by
default
self._useDataClipping = False
I've been meaning to make a matplotlibrc file to control things like
default line width, color, fontsize and name, antialiasing, data
clipping and so on.
JDH
|