Pyxplot

Examples - RGB color mixing


Prev
Next

Download this example:

Using the color map plotting style to produce an arbitrary color image (I)

Here the colormap plotting style is used to produce an arbitrary color distribution in the x-y plane. Two values are passed to the color expression specified using the set colormap command; c1 equals the first plotted expression, x, while c2 equals the second plotted expression, y.

These coordinates are then used to produce three circular pools of red, green and blue light, which overlap to show how the mix together. The function t(r) is used to soften the edges of the pools of light, to look more natural.

Script

set size 7.5 square
set nokey
set nocolkey
set numeric errors quiet
set noxtics ; set noytics
set axis x invisible
set axis y invisible
d    = 0.5
t(x) = max(0,2-exp(x**8))
set colmap rgb(t(hypot(c1  ,c2-d/sqrt(2))), \
               t(hypot(c1+d,c2+d        )), \
               t(hypot(c1-d,c2+d        ))  )
set sample grid 250x250
set c1range norenorm
set c2range norenorm
plot [-1.5:1.5][-1.5:1.5] x:y with colormap