Beispiel #1
0
        /// <summary>
        /// Plots a line plot from a given residual log.
        /// The y-axis will be scaled logarithmically.
        /// </summary>
        private Image drawGnuplotGraph()
        {
            Image graph;

            using (Gnuplot gp = new Gnuplot()) {
                gp.SetXLabel("Iteration");
                gp.SetYLabel(log.Norm + " Norm");
                //gp.Cmd("set terminal wxt noraise title 'SessionGuid: " + log.SessionGuid.ToString() + "'");
                gp.Cmd("set title " + titleOfPlot);
                gp.Cmd("set key outside under horizontal box");
                gp.Cmd("set logscale y");
                gp.Cmd("set format y \"10^{%L}\"");
                gp.Cmd("set grid xtics ytics");

                List <string> KeysToPlot = log.Values.Keys.ToList();
                KeysToPlot.Remove("#Line");
                KeysToPlot.Remove("#Time");
                KeysToPlot.Remove("#Iter");

                for (int i = 0; i < KeysToPlot.Count; i++)
                {
                    gp.PlotXY(log.Values["#Time"], log.Values[KeysToPlot[i]], KeysToPlot[i],
                              new PlotFormat(lineColor: ((LineColors)i), Style: Styles.Lines));
                }

                graph = gp.PlotGIF();
            }

            return(graph);
        }
Beispiel #2
0
        /// <summary>
        /// Draws a graph with Gnuplot and saves it as a gif. Subsequently sets Picture of Form to the plot.
        /// </summary>
        private void drawGnuplotGraph()
        {
            using (Gnuplot gp = new Gnuplot()) {
                gp.SetXLabel("Iteration");
                gp.SetYLabel(log.Norm + " Norm");
                gp.Cmd("set title \"Residual Plot\"");
                gp.Cmd("set key outside under horizontal box");
                gp.Cmd("set logscale y");
                gp.Cmd("set format y \"10^{%L}\"");
                gp.Cmd("set grid xtics ytics");

                List <string> KeysToPlot = log.Values.Keys.ToList();
                KeysToPlot.Remove("#Line");
                KeysToPlot.Remove("#Time");
                KeysToPlot.Remove("#Iter");

                for (int i = 0; i < KeysToPlot.Count; i++)
                {
                    gp.PlotXY(log.Values["#Time"], log.Values[KeysToPlot[i]], KeysToPlot[i],
                              new PlotFormat(lineColor: ((LineColors)i), Style: Styles.Lines));
                }

                Image graph = gp.PlotGIF();
                pictureBox1.Image = graph;
                pictureBox1.Refresh();
            }
        }
Beispiel #3
0
 /// <summary>
 /// Gnuplot plotting, automatic choice of gnuplot driver depending on
 /// the current value of <see cref="UseCairoLatex"/>.
 /// </summary>
 public static object PlotNow(this Gnuplot gp)
 {
     if (UseCairoLatex)
     {
         return(gp.PlotCairolatex());
     }
     else
     {
         return(gp.PlotGIF());
     }
 }
Beispiel #4
0
 /// <summary>
 /// Gnuplot plotting (multiplot), automatic choice of gnuplot driver depending on
 /// the current value of <see cref="UseCairoLatex"/>.
 /// </summary>
 public static object PlotNow(this Plot2Ddata[,] _2DData)
 {
     using (Gnuplot gp = _2DData.ToGnuplot()) {
         if (UseCairoLatex)
         {
             return(gp.PlotCairolatex());
         }
         else
         {
             return(gp.PlotGIF());
         }
     }
 }