@@ -511,6 +511,36 @@ PlotImpulses::PlotImpulses(const DVec &x, const DVec &y)
511511 setCommand (" '" + tmpFileName + " ' u 1:2 w impulses" );
512512}
513513
514+ // PlotGrid constructor ////////////////////////////////////////////////////////
515+ PlotGrid::PlotGrid (const DVec &x, const DVec &y, const DMat &value)
516+ {
517+ if (x.size () != value.rows ())
518+ {
519+ LATAN_ERROR (Size, " x vector does not have the same size as value matrix rows" );
520+ }
521+ if (y.size () != value.cols ())
522+ {
523+ LATAN_ERROR (Size, " y vector does not have the same size as value matrix columns" );
524+ }
525+ if (value.rows () < 2 || value.cols () < 2 )
526+ {
527+ LATAN_ERROR (Size, " value matrix must have at least 2 rows and 2 columns" );
528+ }
529+ DMat d (value.cols ()+1 , value.rows ()+1 );
530+ string tmpFileName;
531+ d (0 ,0 ) = value.cols ();
532+ d.row (0 ).tail (value.cols ()) = x;
533+ d.col (0 ).tail (value.rows ()) = y;
534+ for (Index i = 0 ; i < value.rows (); ++i)
535+ for (Index j = 0 ; j < value.cols (); ++j)
536+ {
537+ d (i+1 , j+1 ) = value (j, i);
538+ }
539+ tmpFileName = dumpToTmpFile (d);
540+ pushTmpFile (tmpFileName);
541+ setCommand (" '" + tmpFileName + " ' nonuniform matrix w image" );
542+ }
543+
514544// PlotMatrixNoRange constructor ///////////////////////////////////////////////
515545PlotMatrixNoRange::PlotMatrixNoRange (const DMat &m)
516546{
0 commit comments