Creating Publication-Quality Figures with PlotLab .NETProducing publication-quality figures is a key skill for researchers, engineers, and data scientists. Well-crafted visuals clarify your results, make manuscripts more persuasive, and help readers reproduce your work. PlotLab .NET is a versatile C# plotting library designed to generate high-quality, customizable figures suitable for journals, conference posters, and presentations. This article walks through principles of publication-ready graphics and demonstrates how to apply them with PlotLab .NET, including code examples, formatting tips, and export strategies.
Why publication-quality matters
High-quality figures:
- Communicate complex data clearly.
- Improve perceived credibility and professionalism.
- Ensure reproducibility when plotted with explicit settings (size, fonts, resolution).
- Meet journal submission requirements (file format, DPI, color profile).
Design principles for publication-ready figures
Follow these core principles regardless of tooling:
- Prioritize clarity: Simplify visuals; avoid unnecessary decorations.
- Use consistent styling: Fonts, line widths, marker sizes and color palettes should be consistent across figures.
- Choose appropriate aspect ratios and sizes: Tailor dimensions to column or page layouts.
- Label everything: Axes, units, legends, and figure panels must be explicit and readable.
- Optimize for print: Use CMYK-safe colors or check journal requirements; set sufficient DPI (typically 300 DPI for color/greyscale).
- Ensure accessibility: Use colorblind-friendly palettes and varying line styles/markers to distinguish series.
Getting started with PlotLab .NET
Install PlotLab .NET via NuGet in your .NET project:
dotnet add package PlotLab.Net
(Replace package name with the exact package ID if different.) Import namespaces in your code:
using PlotLab; using PlotLab.Drawing; using PlotLab.Export;
Create a basic plot:
var plot = new Plot(); plot.Title.Text = "Sample Data"; plot.XAxis.Label.Text = "Time (s)"; plot.YAxis.Label.Text = "Amplitude (units)"; plot.AddLineSeries(xData, yData, seriesName: "Measurement 1");
Example: Creating a multi-panel figure with consistent styling
Below is a fuller example showing how to construct a two-panel figure (side-by-side subplots), apply a consistent theme, customize fonts and line widths, add annotations, and export a high-resolution PNG and vector PDF.
using PlotLab; using PlotLab.Drawing; using PlotLab.Export; using System.Drawing; // sample data generation double[] t = Enumerable.Range(0, 100).Select(i => i * 0.1).ToArray(); double[] y1 = t.Select(x => Math.Sin(x)).ToArray(); double[] y2 = t.Select(x => 0.5 * Math.Cos(x) + 0.1 * new Random(1).NextDouble()).ToArray(); // create figure and panels var figure = new Figure(width: 1600, height: 800); // pixels; adjust for desired aspect figure.Margins = new Margin(60, 40, 20, 80); // shared styling var baseFont = new Font("Helvetica", 14, FontStyle.Regular); var axisFont = new Font("Helvetica", 12, FontStyle.Regular); var palette = new[] { Color.FromArgb(31,119,180), Color.FromArgb(214,39,40) }; // colorblind-friendly // left subplot var ax1 = figure.AddSubplot(0, 0); ax1.Title.Text = "Sine Wave"; ax1.Title.Font = baseFont; ax1.XAxis.Label.Text = "Time (s)"; ax1.YAxis.Label.Text = "Amplitude"; ax1.XAxis.Label.Font = axisFont; ax1.YAxis.Label.Font = axisFont; ax1.Grid.Visible = true; ax1.AddLineSeries(t, y1, color: palette[0], lineWidth: 2, name: "sin(t)"); // right subplot var ax2 = figure.AddSubplot(0, 1); ax2.Title.Text = "Noisy Cosine"; ax2.Title.Font = baseFont; ax2.XAxis.Label.Text = "Time (s)"; ax2.YAxis.Label.Text = "Amplitude"; ax2.XAxis.Label.Font = axisFont; ax2.YAxis.Label.Font = axisFont; ax2.Grid.Visible = true; ax2.AddLineSeries(t, y2, color: palette[1], lineWidth: 2, name: "0.5 cos(t)"); // legend and annotations figure.Legend.Font = axisFont; figure.Legend.Position = LegendPosition.TopRight; ax1.AddAnnotation("Peak", x: 15.7, y: 1.0, font: axisFont, arrow: true); // export high-resolution PNG and vector PDF var pngExporter = new PngExporter(resolutionDpi: 300); pngExporter.Export(figure, "figure_highres.png"); var pdfExporter = new PdfExporter(); pdfExporter.Export(figure, "figure_vector.pdf");
Notes:
- Use deterministic random seeds when creating synthetic/noisy data for reproducibility.
- Adjust figure width/height and DPI so that text and line weights appear correctly when scaled down to journal column widths.
Fonts, text size, and typography
- Use a standard, publication-friendly sans-serif (e.g., Helvetica, Arial) or serif (e.g., Times) depending on journal style. Embed fonts in vector exports when possible.
- Set axis label sizes between 8–12 pt and tick labels slightly smaller. Titles can be larger (12–16 pt) but avoid oversized text.
- Prefer sentence-style capitalization for axis labels and title-case for figure titles unless the journal specifies otherwise.
Example configuration:
figure.DefaultFont = new Font("Helvetica", 12); figure.TickLabelFont = new Font("Helvetica", 10);
Colors and accessibility
- Use colorblind-friendly palettes (e.g., ColorBrewer schemes). Avoid relying on color alone; add different markers or line styles.
- For grayscale printing, verify the figure still conveys differences — use varying line patterns and marker fills.
Example palette usage:
var cbPalette = new[] { ColorTranslator.FromHtml("#377eb8"), ColorTranslator.FromHtml("#e41a1c"), ColorTranslator.FromHtml("#4daf4a") };
Line styles, markers, and markersize
- For multiple series, vary line style (solid, dashed, dotted) and marker type (circle, square, triangle).
- Keep marker sizes moderate (4–8 pt) and line widths around 1–2 pts for print. Increase for presentations.
Example:
ax1.AddLineSeries(x, yA, color: cbPalette[0], lineStyle: LineStyle.Solid, lineWidth: 1.5f, marker: MarkerStyle.Circle, markerSize: 5); ax1.AddLineSeries(x, yB, color: cbPalette[1], lineStyle: LineStyle.Dash, lineWidth: 1.5f, marker: MarkerStyle.Square, markerSize: 5);
Panel layout and figure size
- For multi-panel figures, plan final layout first (single column, double column). Typical journal column widths: ~85 mm (single) and ~180 mm (double).
- Create figures at the target final size in pixels based on DPI. Example: for single-column width 85 mm at 300 DPI:
- width_px = 85 mm * (1 inch / 25.4 mm) * 300 DPI ≈ 1004 px.
PlotLab .NET lets you set figure dimensions explicitly when creating the Figure object.
Export formats: raster vs vector
- Use vector formats (PDF, SVG) for line art, text, and diagrams — they scale without loss.
- Use high-resolution raster (TIFF, PNG at 300–600 DPI) for images with many points or when vectorization isn’t supported.
- Embed fonts in PDFs or convert text to outlines if the journal requires font independence.
Example exporters in PlotLab .NET:
var pdf = new PdfExporter(); pdf.Export(figure, "figure.pdf"); var png = new PngExporter(resolutionDpi: 300); png.Export(figure, "figure.png");
Adding annotations, arrows, inset plots
- Use annotations sparingly to highlight relevant features: peaks, statistical thresholds, or regions of interest.
- For insets, create a smaller subplot placed on top of the main axes; ensure border and background distinguish it from the main plot.
Example annotation:
ax1.AddAnnotation("Significant increase", x: 12.0, y: 0.8, font: axisFont, arrow: true, arrowColor: Color.Black);
Reproducibility and automation
- Script figure generation so figures can be reproduced exactly from data and parameters.
- Store style settings in a single configuration object or theme file and apply it to all figures to maintain consistency across a manuscript.
Example Theme object pattern:
public class PlotTheme { public Font TitleFont { get; set; } public Font AxisFont { get; set; } public Color[] Palette { get; set; } // apply to figure public void ApplyTo(Figure fig) { ... } }
Common pitfalls and how to avoid them
- Tiny text: Check final print size and DPI; increase font sizes relative to final dimensions.
- Overcrowded legends: Use external legends or place them outside the plot area; use concise labels.
- Poor contrast: Avoid low-contrast colors and thin grey lines on white backgrounds.
- Missing units: Always include units in axis labels.
Checklist before submission
- File format matches journal requirements (PDF, EPS, TIFF).
- Font embedding confirmed for vector files.
- DPI and image dimensions correct for single/double column.
- Color/greyscale check passed.
- Legends, labels, and axis ticks readable at final size.
- Figure caption written and references in manuscript checked.
Final tips
- Start designing figures early and iterate as you write.
- Create a style guide for your lab to keep figures uniform.
- When in doubt, simplify — a clear, uncluttered figure beats a busy one.
If you want, I can convert one of your existing plots into a publication-ready PlotLab .NET script — upload the data (CSV or arrays) and tell me target column width and preferred file format.
Leave a Reply