Display Class Reference

Class for displaying matrix data and analytical functions. More...

Public Member Functions

 Display (const char *filebase)
 constructor More...
 ~Display ()
void show ()
 Show data as plot. More...
void save ()
 Save data to postscript file. More...
void setMode (const int &mode)
 Set mode. More...
void setLineStyle (const int &style)
 Set line style. More...
void setUsedDimensions (string s)
 Set line addition. More...
void addMode (const int &mode)
 Add mode.
void rmMode (const int &mode)
 Remove mode.
void setTitle (string title)
 Set title. More...
void addUserSetting (string s)
 Add user setting. More...
void clearUserSettings ()
 Clears all user settings.
Displayoperator<< (Matrix m)
 Insert matrix data. More...
Displayoperator<< (Function &f)
 Insert function. More...
Displayoperator<< (const class DisplayAction &a)
 Execute modification or action. More...

Detailed Description

Class for displaying matrix data and analytical functions.

Display data given as Matrixes or as strings describing functions in various forms. Currently there is only an interface to gnuplot implemented, others shall follow (qwt, grace, qplotter).

Constructor & Destructor Documentation

Display::Display ( const char *  filebase)


filebaseA string which will be used to construct the filenames, which will be called [filebase]000.dat, [filebase]001.dat, ... for the data files, and [filebase].gnuplot for the gnuplot instruction file. Constructs a display. The input argument file is used to create files in which to store data for gnuplot / grace. The will be named, where xxx is a decimal integer running from 000 to 999 (depending on the number of files). After destruction these will not be deleted.

Member Function Documentation

void Display::addUserSetting ( string  s)

Add user setting.

This adds a user setting. The given string will be handed over to gnuplot before the first plot data is made. Example: dsp.addUserSetting("set yrange [-20:20]"); will set the y range to the given interval. It is also possible to add a comment here, which will then appear in the gnuplot file (handy if you want to understand what's in that file you've produced three months ago); Example: dsp.addUserSetting("# this contains the simulated output of an integrate-and-fire neuron with firing rate of 10Hz");.

Display& Display::operator<< ( Matrix  m)

Insert matrix data.

This appends some data to the current display. Use show() to display all data.

Display& Display::operator<< ( Function f)

Insert function.

This appends a function to plot to the current display. The stream must describe a string string which evaluates in gnuplot. Use show() to display all data and functions which have been inserted.

Display& Display::operator<< ( const class DisplayAction a)

Execute modification or action.

This executes a modification (like dsp << set3d;) or an action (like dsp << show;). See the documentation for DisplayAction objects.

void Display::save ( )

Save data to postscript file.

This saves the data. The raw data is saved anyway, this function saves the postscript file which you want to include in your paper.

void Display::setLineStyle ( const int &  style)

Set line style.

Sets the line style of the last plot. Style is an integer >= 0. In gnuplot, if many plots are executed, each plot gets a different colour (if in colour mode), or line style like dottet, dashed, etc. (if in monochrome mode). Using the setLineStyle function you can override this for the plot added last, and can specify a certain value (if you want multiple lines in the same color, for instance). If style==0, gnuplot defaults are used.

void Display::setMode ( const int &  mode)

Set mode.

Sets the display mode. A mode is an |-list of values. This must be done before the first data is inserted using the << operator. Current values are DSP_3D, DSP_2D, DSP_INCLUDE_START, DSP_INCLUDE_END

void Display::setTitle ( string  title)

Set title.

titleThe title. This is the title of the plot, written abouve the actual plot in gnuplot.
void Display::setUsedDimensions ( string  s)

Set line addition.

Sets an addition to the style of the last plot (intended for "using" commands).

void Display::show ( )

Show data as plot.

This displays the data. It opens a terminal with a gnuplot-session, with the data already plotted. The user may close the terminal and/or gnuplot window, or use the terminal to add more plots to the gnuplot window.