[Ocaml-gnuplot-devel] plotitems, tags and global style setting
Status: Beta
Brought to you by:
chris_77
From: Viktor T. <v....@ed...> - 2004-08-10 17:57:03
|
Hi ChriS, > If we move to the > proposal I made to you (plotitems), the implementation will again > change a great deal... BTW, even with plotitems, on could provide > some kind of tags for the user convenience: these would be plotitems > that one can manipulate to (1) add other plotitems, (2) delete some > and, (3) of course, plot them (in the order they were added -- that's > the convenience). ON LEVELS OF PLOTITEMS I think liberating plot-items from style is a good idea (even if you say it means basically only 'save my data', cause it creates the plot-item's data-intensive part). When you associate a plot-item with a viewport and a style, then you create another object, which you manipulate with the help of tags or the way you like (as *your* plot-items above). 1. we need a level for the manupulation of plotitems for user's convenience and for erasure and redraw, replot on a different display. 2. We need a way to be able to reuse the same data in different plots in different viewports without having to recalculate it. My idea was to satisfy 1 and 2 by introducing (a) plotitems (if you like, data uniformly formatted for plotting) which are independent of display style and display location; and (b) plotitems which are associated with a style, a viewport (and a tag). This satisfies 1 and 2 and implementable sg like the way I proposed last time. Your idea, as far as I can see is to have only plotitems which are already styled and manipulate these. This satisfies 1 but to satisfy 2, one should provide function to change the style of the plot-item (thereby keep and not recalculate its data-related content). However the style of a displayed plotitem cannot be changed, because the viewport has to remember the correct style (and linewidth) in order to be able to properly erase a plot. So in this case second level is needed for the plot-objects stored in tags/whatever. Alternatively if the change of style parameters is not in situ then it (a) either involves copying the data-content (violates 2) or (b) sharing the data-content (which is equivalent to my solution). So you need (at least) two levels either way. Maybe you never debated that, in that case it was just a brain exercise for me to understand things more :-) STYLE If you accept that style params like lines/points, width and color should be simultaneouly specified/absent on a particular level, then it follows that in the second case global setting of pen may not be a good idea. This is because plotitems are in principle handle-independent (the moment they are styled, they are not associated with a display) so it would be strange to associate them with a handle only in order to know which pen to use to color them. ON TAGS On your other point about tags vs. just list of styled items given to the display functions, I don't understand if there is much difference. a) If we want to be able to redraw viewports automatically (a la the Managed tag) we can't get away without remembering the styled plots we displayed. b) If we want to allow the user to control which plotitems are managed and which aren't we also have to keep the tag states. For a) and b) it seems reasonable then to keep a history of plots for the viewport: a set of (styled)plotitems with an info whether they are hidden or displayed and should be managed or not. But if plotitems can be sequences of atomic plots, this is equivalent to having tags. Is it not? Sorry if this is hasty. Tomorrow I try to reply in detail. Cheers Viktor |