Example #1
0
        /// <summary>
        /// <see cref="Plot2Ddata"/> into an alive Gnuplot object and executes Gnuplot interactively
        /// </summary>
        public static void PlotInteractive(this Plot2Ddata _2DData, GnuplotPageLayout layout = null)
        {
            using (var gp = ToGnuplot(_2DData, layout)) {
                Console.WriteLine("Executing Gnulpot...");
                gp.Execute();

                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
                Console.WriteLine("killing gnuplot...");
            }
        }
Example #2
0
        /// <summary>
        /// Single plot window:
        /// Converts <see cref="Plot2Ddata"/> into an alive Gnuplot object.
        /// </summary>
        public static Gnuplot ToGnuplot(this Plot2Ddata _2DData, GnuplotPageLayout layout = null)
        {
            if (layout != null)
            {
                throw new NotImplementedException("todo");
            }

            Gnuplot gp = new Gnuplot();

            _2DData.ToGnuplot(gp);
            return(gp);
        }
Example #3
0
        /// <summary>
        /// Multiple plot windows:
        /// Converts <see cref="Plot2Ddata"/> into an alive Gnuplot object.
        /// </summary>
        public static Gnuplot ToGnuplot(this Plot2Ddata[,] _2DData, GnuplotPageLayout layout = null)
        {
            if (layout != null)
            {
                throw new NotImplementedException("todo");
            }
            if (_2DData.GetLowerBound(0) != 0)
            {
                throw new ArgumentException();
            }
            if (_2DData.GetLowerBound(1) != 0)
            {
                throw new ArgumentException();
            }
            if (_2DData.GetLength(0) <= 0)
            {
                throw new ArgumentException();
            }
            if (_2DData.GetLength(1) <= 0)
            {
                throw new ArgumentException();
            }

            Gnuplot gp = new Gnuplot();

            gp.SetMultiplot(_2DData.GetLength(0), _2DData.GetLength(1));

            for (int iRow = 0; iRow < _2DData.GetLength(0); iRow++)
            {
                for (int iCol = 0; iCol < _2DData.GetLength(1); iCol++)
                {
                    if (_2DData[iRow, iCol] != null)
                    {
                        gp.SetSubPlot(iRow, iCol);
                        _2DData[iRow, iCol].ToGnuplot(gp);
                    }
                }
            }
            return(gp);
        }