I want to support two modes for custom coloring schemes in SymPy Plot. The first mode will allow you to supply a single function and a color gradient (pseudo-code):
>>> p[1].color_function = z, (0.0,0.0,1.0), (1.0,0.0,0.0)
This calculates the min and max z-value across the surface, then interpolates from (min, blue) to (max, red). A variation on this syntax allows you to specify more nodes on the color gradient (the fourth component is the linear position [0,1] on the gradient):
>>> p[1].color_function = z, (0.0,0.0,1.0,0.0), (0.0,1.0,0.0,0.5), (1.0,0.0,0.0,1.0)
As you can see, this fades from (min, blue) to (mid, green) to (max, red).
The second coloring mode will allow you to map each RGB component to separate functions. This can be used to colormap three-space vectors, such as surface normals. The simplest usage of this would be:
>>> p[1].color_function = x, y, z
However, this would look pretty bad. In fact, all of the above images used a slightly different color range than was written in the accompanying pseudocode, but they were simplified for clarity. For example, the top one was really more like:
>>> p[1].color_function = z, (0.3,0.3,0.9), (0.9,0.3,0.3)
So in RGB-parametric mode, there will be an enhanced syntax for playing with the dynamic range independently of whatever functions you are using. The current default coloring could be represented with something like:
>>> p[1].color_function = x, (0.5,0.9), y, (0.5,0.9), z, (0.5,0.9)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment