####################################################################### # # # Example: Plotting Color # # # ####################################################################### # # # XMD can produce color plots on a color postscript printer. # # There are two methods of specifying color, RGB (red green blue) # # and HSB (hue saturation brighness). The following example # # draw 64 atoms of varying red, green and blue components. # # # ####################################################################### debug on # # # Make 3D simple cubic lattice # box 4 4 4 particle 1 1 0.50 0.50 0.50 dup 3 1 0 0 dup 3 0 1 0 dup 3 0 0 1 # # Set up plot parameters required by both plots # # Postscript Printer plot device postscript # Number of pages plot page 1 # Number of layers plot layer 4 # Orientation of plot (vertical axis y, horizontal axis x) plot orient y/x # # Give each layer its own red value # Give each column its own green value # Give each row its own blue value # # Assign atom colors # Select each atom in sequence, and assign color # according to its layer, column and row. calc index = 0 calc layer = 0 repeat 4 calc column = 0 repeat 4 calc row = 0 repeat 4 calc index = index + 1 calc red = layer / 3 calc green = column / 3 calc blue = row / 3 # Select each atom in sequence select index index # Assign hue, saturation and brightness plot symbol fill rgb red green blue cir 0.125 calc row = row + 1 end calc column = column + 1 end calc layer = layer + 1 end # # Plot # # Plot label label 1 This is a test of RGB color # plot to output postscript file plot write colorrgb.ps