ScottPlot.NET
GitHub Repo stars

ScottPlot 5 Demo

The ScottPlot 5 Demo is a click-to-run application that demonstrates capabilities of ScottPlot. The demo application displays all ScottPlot 5 Cookbook recipes and demonstrates advanced user control features which are useful in GUI environments.

Notable Demos

These are some of the most useful demonstrations included in the ScottPlot Demo application:

Show Value Under Mouse

The show value under mouse demo uses the control’s MouseMove event to determine the position of the cursor using Plot.GetCoordinates(), determines if a data point is beneath the cursor, and if so places a circular Marker around it. Although this demo showcases data from scatter plots, the concept can be applied to any plot type.

Draggable Axis Lines

The draggable axis line demo shows how to use the user control’s MouseDown, MouseUp, and MouseMove events to check whether a plotted object is beneath the mouse, grab it when clicked, move it when dragged, and drop it. Although this demo only showcases dragging axis lines, this technique can be applied to add interactivity to any plot type.

Draggable Axis Spans

The draggable axis span demo shows how to use the user control’s MouseDown, MouseUp, and MouseMove events to check whether a plotted object is beneath the mouse, grab it when clicked, and move or resize it when dragged. Although this demo only showcases dragging axis spans, this technique can be applied to add interactivity to any plot type.

Draggable Data Points

The draggable points demo shows how to use the user control’s MouseDown, MouseUp, and MouseMove events to check whether a plotted object is beneath the mouse, grab it when clicked, move it when dragged, and drop it.

Selectable Data Points

The select points demo shows how to use the control’s MouseDown, MouseUp, and MouseMove events to track where the mouse was pressed, dragged, and released to determine which data points are within the mouse rectangle. It then places Marker objects over the selected data points. Notice that none of these plot types contain mouse-specific logic, but users can add their own without too much complexity.

Multiplot Layouts

The plot control’s Multiplot system may be used to add subplots and configure their placement in the figure as described on the Multiplot FAQ page and in this demo.

Multiplot with Shared Axes

The plot control’s Multiplot system may be used to add subplots and configure shared axis limits as described on the Multiplot and Shared Axes FAQ pages and in this demo.

Synchronizing Axes Across Multiple Plot Controls

The shared axes demo uses Plot.Axes.Link() to link axis limits between two separate plot controls so changes to the view of one plot are automatically applied to the other.

💡 Users may prefer the simplicity of the Multiplot system described above

Shared Axes

Axis limits may be shared across multiple plots using one of two strategies:

  1. Use the Multiplot system as demonstrated in the the multiplot with shared axes demo

  2. Place multiple controls and synchronize them as shown in multiple plot control demo

Resizable Multiplot

This window demonstrates how subplots can be given zero padding to achieve a collapsed effect, and a custom layout can be created which contains logic for interactivity to allow resizing using the mouse.

Axis Rules

The axis rules demo demonstrates how to add to the list of Plot.Axes.Rules which are applied before rendering each frame. This strategy can be used to set boundaries that limit how far the user can zoom in or out, lock the vertical or horizontal axis, or enforce equal axes scaling such that circles and squares cannot be stretched into rectangles and ellipses.

Continuously Autoscale

Custom logic may be applied to refine axis limits at the start of each render. A common use case, demonstrated here, is automatically scaling vertically to fit the range of data encompassed by the horizontal view. Implementation details may differ whether the data is displayed as a scatter plot, signal plot, or something else, but the underlying concept is the same.

Custom Plot Type

The custom plot type demo shows how to create a custom plot type that implements IPlottable to allow full customization over styling and behavior. Creating custom plot types is useful for experimenting with new types of plots and does not require editing ScottPlot’s source code.

Custom Context Menu

The custom right-click menu shows how to customize the context menu that appears when users right-click the plot. Developers can call the control’s Menu.Clear() method to remove default menu items then call the control’s Menu.Add() method to add new items which call custom actions when clicked.

Custom Mouse Actions

The custom mouse actions demo shows how to customize which mouse actions perform various operations on the plot. This strategy can be used to enable alternative behaviors such as middle-click-drag panning, right-click autoscaling, and left-click launching a context menu.

Multi-Axis

The multi-axis demo plots data with largely different dimensions on multiple axes with different scales, then demonstrates how to interact with the multi-axis plot.

Plot Streaming Data

The data streamer demo displays live data using a fixed number of data points. The oldest data points are removed as new data points are shifted in. If the ManageAxisLimits property is enabled, the data streamer will automatically adjust the axis limits to keep the incoming data in view. The data streamer plot type has options for switching between a wipe view (like an ECG machine) and a scroll view (where the newest data is always on one side of the plot).

Plot Growing Data

The data logger demo displays live data in a List that grows as new data is added. If the ManageAxisLimits property is enabled, the data logger will automatically adjust the axis limits to keep the incoming data in view. The data logger plot type has options for switching between a full signal view or views that focus on the latest portion of the incoming signal.

Plot Live Financial Data

The Live Finance demo demonstrates how to display price OHLC data in real time, modifying the last bar for live updates and adding new bars as time progresses.

All WinForms Demo Windows

Download the WinForms demo at the top of the page to run these interactively

  • ScottPlot 5.1.60 Cookbook - Common ScottPlot features demonstrated as interactive graphs displayed next to the code used to create them
  • Mouse Tracker - Demonstrates how to interact with the mouse and convert between screen units (pixels) and axis units (coordinates)
  • Draggable Axis Lines - Demonstrates how to add mouse interactivity to plotted objects
  • Draggable Data Points - GUI events can be used to interact with data drawn on the plot. This example shows how to achieve drag-and-drop behavior for points of a scatter plot. Extra code may be added to limit how far points may be moved.
  • Axis Rules - Configure rules that limit how far the user can zoom in or out or enforce equal axis scaling
  • Continuously Autoscale - Custom axis scale logic may be applied at the start of each render
  • Custom Axis - How to create a custom axis class that implements IAxis to create totally customizable axis panels
  • Custom Fonts - Demonstrates how to create plots that render text using fonts defined in an external TTF file.
  • Custom Marker Shapes - Demonstrates how to create plots using custom markers
  • Custom Right-Click Context Menu - Demonstrates how to replace the default right-click menu with a user-defined one that performs custom actions.
  • Custom Mouse Actions - Demonstrates how to disable the mouse or changes what the button actions are
  • Custom Plot Type - How to create a custom plot type that implements IPlottable to achieve full customization over how data is rendered on a plot.
  • Data Logger - Plots live streaming data as a growing line plot.
  • Data Streamer - Plots live streaming data as a fixed-width line plot, shifting old data out as new data comes in.
  • Detachable Legend - Add an option to the right-click menu to display the legend in a pop-up window
  • Draggable Axis Spans - Demonstrates how to create a mouse-interactive axis span that can be resized or dragged
  • Draggable Callout - Demonstrates how to make a Callout mouse-interactive
  • Live Heatmap - Demonstrates how to display a heatmap with data that changes over time
  • Background Images - Use a bitmap image for the background of the figure or data area
  • Interactive Plottables - Some plot types are immediately interactive, without requiring the user to wire any mouse tracking.
  • Font Styling - A tool to facilitate evaluating different fonts and the customization options for size, alignment, line height, and more.
  • Legend Outside the Plot (Bitmap) - Demonstrates how to display the legend outside the plot by obtaining it as a Bitmap and displaying it outside the plot control anywhere in your window.
  • Live Financial Plot - Demonstrates how to display price OHLC data in real time, modifying the last bar for live updates and adding new bars as time progresses.
  • Live Histogram - A continuously updating histogram that expands binned counts as new values are added.
  • Microphone Demo - Plot real-time audio signal data from the microphone
  • Multi-Axis - Display data which visually overlaps but is plotted on different axes
  • Multiplot with Advanced Layout - Custom multi-plot layouts may be achieved by assigning fractional rectangle dimensions to each subplot
  • Multiplot Layout Alignment - Plots automatically resize the data area to accommodate tick labels of varying length, but this may lead to misaligned data areas in multiplot figures. Using a fixed padding resolves this issue.
  • Custom Multiplot System - Although the default Multiplot is suitable for most applications, advanced users may achieve extreme control by creating a class that implements IMultiplot.
  • Multiplot with Draggable Subplots - Subplots may be placed very close together by setting their padding to zero. This example uses an advanced Layout system to enable mouse drag resizing of subplots.
  • Multiplot with Growing Axes - Demonstrates how to allow axes to grow to fit long tick labels while maintaining layout alignment across subplots in a multiplot.
  • Multiplot with shared axis limits - Updates to axis limits of a subplot may be applied to all other subplots in the multiplot.
  • OpenGL Example - Compare the standard (CPU) vs OpenGL (GPU) rendering of plot controls
  • Persisting Plot - Manipulations to a Plot on another Form persist through Close() events
  • Draggable Plottables - Demonstrates how to create Plottables which can be dragged with the mouse
  • Plot Viewer - A Plot can be created programmatically and displayed in a pop-up window. This strategy can be used to launch mouse-interactive plots from console applications if the ScottPlot.WinForms package is included.
  • Report Viewer - A simple strategy for displaying multiple plots paired with descriptions
  • Plot is a Scroll Viewer - How to switch between using the mouse wheel to scroll up/down vs. zoom in/out
  • Select Data Points - Demonstrates how to use mouse events to draw a rectangle around data points to select them
  • Shared Axes - Link two controls together so they share an axis and have aligned layouts
  • Show Value Under Mouse, Scatter - How to sense where the mouse is in coordinate space and retrieve information about the plotted data the cursor is hovering over
  • Show Value Under Mouse, Multiple Scatter - How to sense where the mouse is in coordinate space and retrieve information about the plottable and data the cursor is hovering over
  • Show Value Under Mouse, SignalXY - Demonstrates how to determine where the cursor is in coordinate space and identify the data point closest to it.
  • Scatter Plot, Signal Plot, and SignalConst - Demonstrates performance of Scatter plots, Signal Plots, and SignalConst on large datasets.
  • Mouse Interactive SignalXY Plots - Demonstrates how to create SignalXY plots which can be dragged with the mouse, and also how to display informatoin about which point is nearest the cursor.
  • Transparent Background - Plot controls may be made transparent so the Form beneath it can shine through

All WPF Demos

Download the ScottPlot repository on GitHub to run these interactively

  • WPF Quickstart - Create a simple plot using the WPF control.
  • Display Scaling - Demonstrates how to track mouse position on displays which use DPI scaling.
  • WPF Multi-Threading - Demonstrate how to safely change data while rendering asynchronously.