|
From: Andre W. <wo...@us...> - 2004-07-22 14:57:25
|
Hi Jörg,
On 22.07.04, Joerg Lehmann wrote:
> On 22.07.04, Andre Wobst wrote:
> > Right. You can even make this a style option (if you like):
> >
> > p = g.plot(graph.data(...), [graph.style.line(returnpath=1)])
>
> Yes, but probably that's not necessary.
Sure. But we're able to allow for it. There might be usecases in the
future.
> That's exactly the reason why I don't like this idea. I really think we
> shouln't expose the sharedata and privatedata lists, which really are
> internal implementation details, to the user.
>
> Btw, we could also introduce a new style method which is responsible for
> returning the return value, when called with the corresponding sharedata
> and privatedata objects.
This is too complicated for the user. You need the
sharedata/privatedatalist from a given plot command and put it into
the styles to recieve some information. Hmmm. I don't see any
advantage of this quite complicated way to extract information.
First I thought it would be a bad idea to return something else than
the data instance at the plot command (because its like what we do in
canvas.insert etc.). On the other hand, the data is not -- *never* --
bound tightly to the graph. It contains no information about what's
plotted. (Currently, it does, because sharedata and privatedatalist is
storred in the data instance, but thats a misfeature we will resolve
in the future. Once we did, there seems to be no reason at all, why a
data instance does not contain any information about the output
created. In the future I don't see any reason, why the data would need
a container like privatedata/sharedata/styledata. It does not have to
store anything related to the graph.)
Hence I think it would be good to allow the styles to return something
related to the stuff actually drawn. The only remaining question is,
whether this fancy_return is the right thing to do. I'm still not
satisfied. In some sense it makes sense to make the finish process
visible. Back to #2: Explicit is better than implicit. What about
something along the lines:
pd = graph.plot(data(...), [graph.style.line()])
p = pd.finish()
where pd are the "plot data" and p is the path. Its more or less back
to what we had in the sense, that we have this plot data construct,
which takes care about the graph instance needed, the data and styles
in use, the return values, the finishing process etc. Still, the
styles should be responsible to create the return value(s). In the
first we only need to return the path when creating a line. The plot
data instances will have a finish method only, which will take care of
the internals and return the draw results from the styles. And that's
it. I think that's probably ok. Its not that complicated and its quite
explicit.
André
--
by _ _ _ Dr. André Wobst
/ \ \ / ) wo...@us..., http://www.wobsta.de/
/ _ \ \/\/ / PyX - High quality PostScript figures with Python & TeX
(_/ \_)_/\_/ visit http://pyx.sourceforge.net/
|