Esempio n. 1
0
        /// <summary>
        /// Simple plotting interface
        /// </summary>
        /// <returns>Output of <see cref="GnuplotExtensions.PlotNow(Gnuplot)"/></returns>
        static public object Plot(IEnumerable <double> X1, IEnumerable <double> Y1, string Name1 = null, string Format1 = null,
                                  IEnumerable <double> X2 = null, IEnumerable <double> Y2 = null, string Name2 = null, string Format2 = null,
                                  IEnumerable <double> X3 = null, IEnumerable <double> Y3 = null, string Name3 = null, string Format3 = null,
                                  IEnumerable <double> X4 = null, IEnumerable <double> Y4 = null, string Name4 = null, string Format4 = null,
                                  IEnumerable <double> X5 = null, IEnumerable <double> Y5 = null, string Name5 = null, string Format5 = null,
                                  IEnumerable <double> X6 = null, IEnumerable <double> Y6 = null, string Name6 = null, string Format6 = null,
                                  IEnumerable <double> X7 = null, IEnumerable <double> Y7 = null, string Name7 = null, string Format7 = null,
                                  bool logX = false, bool logY = false)
        {
            using (var gp = new Gnuplot()) {
                IEnumerable <double>[] Xs = new[] { X1, X2, X3, X4, X5, X6, X7 };
                IEnumerable <double>[] Ys = new[] { Y1, Y2, Y3, Y4, Y5, Y6, Y7 };
                string[] Ns = new string[] { Name1, Name2, Name3, Name4, Name5, Name6, Name7 };
                string[] Fs = new string[] { Format1, Format2, Format3, Format4, Format5, Format6, Format7 };

                for (int i = 0; i < 7; i++)
                {
                    if (Ys[i] != null)
                    {
                        var f1 = new PlotFormat();
                        if (Fs[i] != null)
                        {
                            f1.FromString(Fs[i]);
                        }
                        gp.PlotXY(Xs[i], Ys[i], title: Ns[i], format: f1, logX: logX, logY: logY);
                    }
                }

                return(gp.PlotNow());
            }
        }