NAME

PDL::Graphics::Prima::Palette - a set of palettes for the Prima graph widget

DESCRIPTION

Suppose you want to use color to convey some meaningful value. For example, you want the color to represent the topography of a landscape, darker is lower, lighter is higher. In that case, you need a mapping from a height to a color, i.e. from a scalar value to a color. This is what palettes provide.

new

You will almost always create palettes using the nick-names in the pal namespace. However, all Palette classes know how to make new copies of themselves.

apply

Every palette knows how to apply itself to its data. The apply function returns a piddle of Prima color values given a piddle of scalar values.

plotType

Every Palette knows the specific data and plot type to which it belongs. The first time that a Palette is used in a drawing operation, it will become associated with that specific plotType object, which is in turn associated with that specific dataSet and widget. Thereafter, you can retrieve the plotType object using this accessor, but you cannot change it. If you want to use the same Palette on a different plotType, you can copy it using pal::Copy.

copy

Not yet implemented.

You can make a copy of a Palette that does not have an associated plotType. This way, if you put a lot of effort into making a palette, you can easily reuse that palette with minimal effort.

Special Palettes

This module provides many ready-made palettes with short-name constructors in the pal namespace.

pal::Rainbow

Runs from red->orange->yellow->green->blue->purple->red in ascending order.

pal::BlackToWhite

Larger values are white, smaller values are black

pal::WhiteToBlack

Larger values are black, smaller values are white

pal::WhiteToHSV

Smaller values are closer to white, larger values are closer to the color indicated by the HSV values that you specify, which are supplied to the function as three different scalars.

For example:

my ($h, $s, $v) = pdl(cl::LightRed)->color_to_rgb->rgb_to_hsv->dog;
my $white_to_red = pal::WhiteToHSV($h, $s, $v);
pal::BlackToHSV

Like WhiteToHSV, but smaller values are closer to black instead of white.

pal::HSVrange

Goes in ascending order from the start to the stop values in hue, saturation, and value. All values are specified with key => value pairs. For example, to go from blue to red:

my ($start_h, $start_s, $start_v)
  = pdl(cl::LightBlue)->color_to_rgb->rgb_to_hsv->dog;
my ($stop_h, $stop_s, $stop_v)
  = pdl(cl::LightRed)->color_to_rgb->rgb_to_hsv->dog;

my $blue_to_red = pal::HSVrange(
      h_start => $start_h,
      s_start => $start_s,
      v_start => $start_v,
      h_stop  => $stop_h,
      s_stop  => $stop_s,
      v_stop  => $stop_v,
  );

AUTHOR

David Mertens (dcmertens.perl@gmail.com)

SEE ALSO

This is a component of PDL::Graphics::Prima. This library is composed of many modules, including:

PDL::Graphics::Prima

Defines the Plot widget for use in Prima applications

PDL::Graphics::Prima::Axis

Specifies the behavior of axes (but not the scaling)

PDL::Graphics::Prima::DataSet

Specifies the behavior of DataSets

PDL::Graphics::Prima::Internals

A dumping ground for my partial documentation of some of the more complicated stuff. It's not organized, so you probably shouldn't read it.

PDL::Graphics::Prima::Limits

Defines the lm:: namespace

PDL::Graphics::Prima::Palette

Specifies a collection of different color palettes

PDL::Graphics::Prima::PlotType

Defines the different ways to visualize your data

PDL::Graphics::Prima::Scaling

Specifies different kinds of scaling, including linear and logarithmic

PDL::Graphics::Prima::Simple

Defines a number of useful functions for generating simple and not-so-simple plots

LICENSE AND COPYRIGHT

Portions of this module's code are copyright (c) 2011 The Board of Trustees at the University of Illinois.

Portions of this module's code are copyright (c) 2011-2012 Northwestern University.

This module's documentation are copyright (c) 2011-2012 David Mertens.

All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.