Skip to main content

Plotting libraries

Nancy includes separate plotting packages for different targets.

Overview​

  • Unipi.Nancy.Plots.ScottPlot for static bitmap images
  • Unipi.Nancy.Plots.Terminal for terminal output
  • Unipi.Nancy.Plots.Tikz for LaTeX/TikZ code
  • Unipi.Nancy.Plots.XPlot.Plotly for HTML / browser plots

All of them work with the core Curve and Sequence types from Unipi.Nancy.

ScottPlot​

Use this package when you want a PNG image that you can save to disk or embed in a report.

#r "nuget: Unipi.Nancy@1.3.0"
#r "nuget: Unipi.Nancy.Plots.ScottPlot@1.0.4"

using System.IO;
using Unipi.Nancy.MinPlusAlgebra;
using Unipi.Nancy.Numerics;
using Unipi.Nancy.Plots.ScottPlot;

var sc = new RateLatencyServiceCurve(3, 1);
var ac = new SigmaRhoArrivalCurve(2, 2);

var bytes = ScottPlots.ToScottPlotImage([ac, sc], ["arrival", "service"]);
File.WriteAllBytes("plot.png", bytes);

Terminal​

Use this package when you want a quick text plot in a console application.

#r "nuget: Unipi.Nancy@1.3.0"
#r "nuget: Unipi.Nancy.Plots.Terminal@1.0.4"

using Unipi.Nancy.MinPlusAlgebra;
using Unipi.Nancy.Numerics;
using Unipi.Nancy.Plots.Terminal;

var sc = new RateLatencyServiceCurve(3, 1);
var ac = new SigmaRhoArrivalCurve(2, 2);

Console.WriteLine(TerminalPlots.ToTerminalPlot([ac, sc], ["arrival", "service"]));

TikZ​

Use this package when you want to generate LaTeX-friendly plot code.

#r "nuget: Unipi.Nancy@1.3.0"
#r "nuget: Unipi.Nancy.Plots.Tikz@1.0.4"

using Unipi.Nancy.MinPlusAlgebra;
using Unipi.Nancy.Numerics;
using Unipi.Nancy.Plots.Tikz;

var sc = new RateLatencyServiceCurve(3, 1);
var ac = new SigmaRhoArrivalCurve(2, 2);

var tikzCode = TikzPlots.ToTikzPlotCode([ac, sc], ["arrival", "service"]);
Console.WriteLine(tikzCode);

Plotly​

Use this package when you want HTML output that can be shown in a browser or embedded in a web page.

#r "nuget: Unipi.Nancy@1.3.0"
#r "nuget: Unipi.Nancy.Plots.XPlot.Plotly@1.0.4"

using System.IO;
using Unipi.Nancy.MinPlusAlgebra;
using Unipi.Nancy.Numerics;
using Unipi.Nancy.Plots.XPlot.Plotly;

var sc = new RateLatencyServiceCurve(3, 1);
var ac = new SigmaRhoArrivalCurve(2, 2);

var html = XPlotPlots.ToXPlotHtml([ac, sc], ["arrival", "service"]);
File.WriteAllText("plot.html", html);