> Hi John, > > I'm sorry for comming back to that thread after such a long period of > silence from my side. And so far I don't yet really understand your > problem and what you really want to do.
Thanks for such a long and detailed reply. I'll try to be clearer this time around. :) > Yes, we do have palettes in PyX. Palettes are tools which provide a > color for a given continuous variable in range 0 to 1 by the getcolor > method. That's about it for the moment. Understood. From a user point of view, though, I think a palette is properly a means to assign colors to a set of discrete objects. For the purposes of this note, I'll call those objects "points". So if my input is n points and one palette, I'll get back a color for each of those n points. The interface that I think the user wants, for n points, is: palette.getColor(0, n) => gives the first point's color palette.getColor(1, n) => gives the second point's color etc. Now, under the hood, that's implemented as a linear interpolation. Also, the need to specifically make that call is hidden, which is cool; it's all done under the hood as well. But somewhere in the code this calculation is made, and it's a function of the point number (first point, second point, etc.) and the total number of points. My first question, then, is where specifically is this done? I admit I haven't dived in too deep, but I'm fairly sure the linear interpolant is calculated as "point_number / total_number_of_points", and I don't know where it's done in the code. You mention to start (below) in "plotitems" so I'll start poking around there; any further pointers would be appreciated. Anyway, assuming that you do in fact make a color calculation based on the point number, the total number of points, and some data structure that you call a palette, could you generalize that calculation? Rather than a palette, I note I can use a function for each of r, g, b. That's cool. What I would like to do is a lookup table (dictionary) instead. I'd like to do color = mylookuptable[total_number_of_points][point_number]. > Well, you can first store all point data and delay the selection until > all data has been processed. Then you can just count the number of > points. This is similar to what the graph is doing all the time ... Yes, to do this I would definitely need to have the number of points. As long as the underlying system is doing this for me and calculating colors after all points are specified, though, we ought to be able to utilize that data rather than make me deal with it at the user level. Thanks. JDO _______________________________________________ PyX-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyx-user
