Specializing the PLplot C++ Interface

The plstream class is an ideal candidate for derivation. By inheriting from plstream, the user can construct a new class which is automatically endowed with the ability to plot to a specific PLplot output stream in a coherent manner without having to worry about interplay with other plstream (or derived type) objects. Moreover, new, higher level, plotting functionality can be constructed to provide even more simplicity and ease of use than the PLplot API.

The PLplot maintainers (Geoff and Maurice) expect to introduce a class plxstream in the future which provides superior support for constructing graphics with multiple plots per page, easier specification of plot adornments, etc. This should significantly ease one aspect of PLplot usage which we regard as being clumsy at this time.

Beyond that, users may find it useful to derive from plstream (or later plxstream whenever it finally makes its appearance) for the purpose of making "application specific" output streams. For example, a C++ program will normally have a variety of objects which constitute the fundamental entities in the code. These could all be made to be "atomically plotted" by providing suitable methods. For example:

      class Cat { ... };
      class Dog { ... };
      class Bear { ... };
      class Fish { ... };

      class zoostream : public plstream {
      public:
      void plot( const Cat& c ) { ... }
      void plot( const Dog& d ) { ... }
      void plot( const Bear& b ) { ... }
      void plot( const Fish& f ) { ... }
      };
    

Presumably the PLplot user community can think of even more imaginative uses... :-).