ScottPlot
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
ScottPlot.Plot Class Reference
Inheritance diagram for ScottPlot.Plot:
IDisposable

Public Member Functions

 Plot ()
 
void Dispose ()
 
Pixel GetPixel (Coordinates coordinates)
 Return the location on the screen (pixel) for a location on the plot (coordinates) on the default axes. The figure size and layout referenced will be the one from the last render.
 
Pixel GetPixel (Coordinates coordinates, IXAxis xAxis, IYAxis yAxis)
 Return the location on the screen (pixel) for a location on the plot (coordinates) on the given axes. The figure size and layout referenced will be the one from the last render.
 
Coordinates GetCoordinates (Pixel pixel, IXAxis? xAxis=null, IYAxis? yAxis=null)
 Return the coordinate for a specific pixel using measurements from the most recent render.
 
Coordinates GetCoordinates (float x, float y, IXAxis? xAxis=null, IYAxis? yAxis=null)
 Return the coordinate for a specific pixel using measurements from the most recent render.
 
CoordinateRect GetCoordinateRect (float x, float y, float radius=10, IXAxis? xAxis=null, IYAxis? yAxis=null)
 Return a coordinate rectangle centered at a pixel. Uses measurements from the most recent render.

Parameters
xCenter point pixel's x
yCenter point pixel's y
radiusRadius in pixels
Returns
The coordinate rectangle

 
CoordinateRect GetCoordinateRect (Pixel pixel, float radius=10, IXAxis? xAxis=null, IYAxis? yAxis=null)
 Return a coordinate rectangle centered at a pixel. Uses measurements from the most recent render.

Parameters
pixelCenter point pixel
radiusRadius in pixels
Returns
The coordinate rectangle

 
CoordinateRect GetCoordinateRect (Coordinates coordinates, float radius=10, IXAxis? xAxis=null, IYAxis? yAxis=null)
 Return a coordinate rectangle centered at a coordinate pair with the radius specified in pixels. Uses measurements from the most recent render.

Parameters
coordinatesCenter point in coordinate units
radiusRadius in pixels
Returns
The coordinate rectangle

 
IAxisGetAxis (Pixel pixel)
 Get the axis under a given pixel.
 
IPanelGetPanel (Pixel pixel, bool axesOnly)
 Get the panel under a given pixel.
 
void Render (int width=400, int height=300)
 
void RenderInMemory (int width=400, int height=300)
 Create a new image of the given dimensions, render the plot onto it, and return it.
 
void Render (SKCanvas canvas, int width, int height)
 Render onto an existing canvas with the given dimensions.
 
void Render (SKCanvas canvas, PixelRect rect)
 Render onto an existing canvas inside the given rectangle.
 
void Render (SKSurface surface)
 Render onto an existing canvas of a surface over the local clip bounds.
 
Image GetImage (int width, int height)
 
string GetImageHtml (int width, int height)
 
string GetPngHtml (int width, int height, string classContent="", string styleContent="")
 Render the plot and return an HTML img element containing a Base64-encoded PNG.
 
string GetSvgHtml (int width, int height)
 Render the plot and return a plain text SVG element suitable for insertion into HTML.
 
SavedImageInfo SaveJpeg (string filePath, int width, int height, int quality=85)
 
SavedImageInfo SavePng (string filePath, int width, int height)
 
SavedImageInfo SaveBmp (string filePath, int width, int height)
 
SavedImageInfo SaveWebp (string filePath, int width, int height, int quality=85)
 
SavedImageInfo SaveSvg (string filePath, int width, int height)
 
string GetSvgXml (int width, int height)
 
SavedImageInfo Save (string filePath, int width, int height)
 
SavedImageInfo Save (string filePath, int width, int height, ImageFormat format, int quality=85)
 
byte[] GetImageBytes (int width, int height, ImageFormat format=ImageFormat.Bmp)
 
Image GetLegendImage ()
 Returns the content of the legend as a raster image.
 
string GetLegendSvgXml ()
 Returns the content of the legend as SVG (vector) image.
 
IEnumerable< IPlottableGetPlottables ()
 Return contents of PlottableList.
 
IEnumerable< T > GetPlottables< T > ()
 Return all plottables in PlottableList of the given type.
 
void Remove (IPlottable plottable)
 Remove the given plottable from the PlottableList.
 
void Remove (IPanel panel)
 Remove the given Panel from the Axes.
 
void Remove (IAxis axis)
 Remove the given Axis from the Axes.
 
void Remove (Type plotType)
 Remove all items of a specific type from the PlottableList.
 
void Remove< T > ()
 Remove a all instances of a specific type from the PlottableList.
 
void Remove< T > (Func< T, bool > predicate)
 Remove all instances of a specific type from the PlottableList that meet the predicate criteraia.
 
void MoveToTop (IPlottable plottable)
 Move the indicated plottable to the end of the list so it is rendered last and appears above all other plottables.
 
void MoveToBottom (IPlottable plottable)
 Move the indicated plottable to the start of the list so it is rendered first and appears below all other plottables.
 
void MoveToFront (IPlottable plottable)
 Move the indicated plottable to the end of the list so it is rendered last.
 
void MoveToBack (IPlottable plottable)
 Move the indicated plottable to the start of the list so it is rendered first.
 
void HideAxesAndGrid (bool showTitle=true)
 Disable visibility for all axes and grids.
 
void HideGrid ()
 Disable visibility for all grids.
 
void ShowGrid ()
 Enable visibility for all grids.
 
Legend ShowLegend ()
 Helper method for setting visibility of the Legend
 
Legend ShowLegend (Alignment alignment)
 Helper method for setting visibility of the Legend and setting Legend.Location to the provided one.
 
Legend ShowLegend (Alignment alignment, Orientation orientation)
 Helper method for setting the Legend's IsVisible, Alignment, and Orientation properties all at once.
 
Legend ShowLegend (IEnumerable< LegendItem > items, Alignment location=Alignment.LowerRight)
 Helper method for displaying specific items in the legend.
 
Panels.LegendPanel ShowLegend (Edge edge)
 Hide the default legend (inside the data area) and create a new legend panel placed on the edge of the figure outside the data area.
 
Legend HideLegend ()
 Helper method for setting visibility of the Legend
 
void Clear ()
 Clears the PlottableList list.
 
void Clear< T > ()
 Clear a all instances of a specific type from the PlottableList.
 
void Title (string text, float? size=null)
 Shortcut to set text of the TitlePanel Label. Assign properties of TitlePanel Label to customize size, color, font, etc.
 
void XLabel (string label, float? size=null)
 Shortcut to set text of the BottomAxis Label Assign properties of BottomAxis Label to customize size, color, font, etc.
 
void YLabel (string label, float? size=null)
 Shortcut to set text of the BottomAxis Label Assign properties of BottomAxis Label to customize size, color, font, etc.
 
PlotStyle GetStyle ()
 Return the current style settings for this plot.
 
void SetStyle (PlotStyle style)
 Apply the given style settings to this plot.
 
void SetStyle (Plot otherPlot)
 Apply the style settings from the given plot to this plot.
 
void Developer_ShowAxisDetails (bool enable=true)
 

Static Public Member Functions

static DefaultGrid GetDefaultGrid ()
 

Public Attributes

BackgroundStyle FigureBackground = new() { Color = Colors.White }
 Style for the background of the entire figure.
 
BackgroundStyle DataBackground = new() { Color = Colors.Transparent }
 Style for the data area (the area within the axis frames)
 

Properties

List< IPlottablePlottableList = [] [get]
 
PlottableAdder Add [get]
 
RenderManager RenderManager [get]
 
RenderDetails LastRender [get]
 
LayoutManager Layout [get]
 
IZoomRectangle ZoomRectangle [get, set]
 
double ScaleFactor [get, set]
 
AxisManager Axes [get]
 
PlotStyler Style = new() [get]
 
FontStyler Font [get]
 
Legend Legend [get, set]
 
DefaultGrid Grid [get]
 
IPlottable Benchmark = new Plottables.Benchmark() [get, set]
 
object Sync = new() [get]
 This object is locked by the Render() methods. Logic that manipulates the plot (UI inputs or editing data) can lock this object to prevent rendering artifacts.
 
IPlotControlPlotControl = null [get, set]
 In GUI environments this property holds a reference to the interactive plot control.
 

Constructor & Destructor Documentation

◆ Plot()

ScottPlot.Plot.Plot ( )
inline

Member Function Documentation

◆ Clear()

void ScottPlot.Plot.Clear ( )

Clears the PlottableList list.

◆ Clear< T >()

void ScottPlot.Plot.Clear< T > ( )
inline

Clear a all instances of a specific type from the PlottableList.

Template Parameters
TType of IPlottable to be cleared
Type Constraints
T :IPlottable 

◆ Developer_ShowAxisDetails()

void ScottPlot.Plot.Developer_ShowAxisDetails ( bool  enable = true)
inline

◆ Dispose()

void ScottPlot.Plot.Dispose ( )
inline

◆ GetAxis()

IAxis? ScottPlot.Plot.GetAxis ( Pixel  pixel)
inline

Get the axis under a given pixel.

Parameters
pixelPoint
Returns
The axis at pixel (or null)

◆ GetCoordinateRect() [1/3]

CoordinateRect ScottPlot.Plot.GetCoordinateRect ( Coordinates  coordinates,
float  radius = 10,
IXAxis xAxis = null,
IYAxis yAxis = null 
)
inline

Return a coordinate rectangle centered at a coordinate pair with the radius specified in pixels. Uses measurements from the most recent render.

Parameters
coordinatesCenter point in coordinate units
radiusRadius in pixels
Returns
The coordinate rectangle

◆ GetCoordinateRect() [2/3]

CoordinateRect ScottPlot.Plot.GetCoordinateRect ( float  x,
float  y,
float  radius = 10,
IXAxis xAxis = null,
IYAxis yAxis = null 
)
inline

Return a coordinate rectangle centered at a pixel. Uses measurements from the most recent render.

Parameters
xCenter point pixel's x
yCenter point pixel's y
radiusRadius in pixels
Returns
The coordinate rectangle

◆ GetCoordinateRect() [3/3]

CoordinateRect ScottPlot.Plot.GetCoordinateRect ( Pixel  pixel,
float  radius = 10,
IXAxis xAxis = null,
IYAxis yAxis = null 
)
inline

Return a coordinate rectangle centered at a pixel. Uses measurements from the most recent render.

Parameters
pixelCenter point pixel
radiusRadius in pixels
Returns
The coordinate rectangle

◆ GetCoordinates() [1/2]

Coordinates ScottPlot.Plot.GetCoordinates ( float  x,
float  y,
IXAxis xAxis = null,
IYAxis yAxis = null 
)
inline

Return the coordinate for a specific pixel using measurements from the most recent render.

◆ GetCoordinates() [2/2]

Coordinates ScottPlot.Plot.GetCoordinates ( Pixel  pixel,
IXAxis xAxis = null,
IYAxis yAxis = null 
)
inline

Return the coordinate for a specific pixel using measurements from the most recent render.

◆ GetDefaultGrid()

static DefaultGrid ScottPlot.Plot.GetDefaultGrid ( )
static

◆ GetImage()

Image ScottPlot.Plot.GetImage ( int  width,
int  height 
)
inline

◆ GetImageBytes()

byte[] ScottPlot.Plot.GetImageBytes ( int  width,
int  height,
ImageFormat  format = ImageFormat::Bmp 
)
inline

◆ GetImageHtml()

string ScottPlot.Plot.GetImageHtml ( int  width,
int  height 
)
inline

◆ GetLegendImage()

Image ScottPlot.Plot.GetLegendImage ( )

Returns the content of the legend as a raster image.

◆ GetLegendSvgXml()

string ScottPlot.Plot.GetLegendSvgXml ( )

Returns the content of the legend as SVG (vector) image.

◆ GetPanel()

IPanel? ScottPlot.Plot.GetPanel ( Pixel  pixel,
bool  axesOnly 
)
inline

Get the panel under a given pixel.

Parameters
pixelPoint
Returns
The panel at pixel (or null)

◆ GetPixel() [1/2]

Pixel ScottPlot.Plot.GetPixel ( Coordinates  coordinates)

Return the location on the screen (pixel) for a location on the plot (coordinates) on the default axes. The figure size and layout referenced will be the one from the last render.

◆ GetPixel() [2/2]

Pixel ScottPlot.Plot.GetPixel ( Coordinates  coordinates,
IXAxis  xAxis,
IYAxis  yAxis 
)
inline

Return the location on the screen (pixel) for a location on the plot (coordinates) on the given axes. The figure size and layout referenced will be the one from the last render.

◆ GetPlottables()

IEnumerable< IPlottable > ScottPlot.Plot.GetPlottables ( )
inline

Return contents of PlottableList.

◆ GetPlottables< T >()

Return all plottables in PlottableList of the given type.

Type Constraints
T :IPlottable 

◆ GetPngHtml()

string ScottPlot.Plot.GetPngHtml ( int  width,
int  height,
string  classContent = "",
string  styleContent = "" 
)
inline

Render the plot and return an HTML img element containing a Base64-encoded PNG.

◆ GetStyle()

PlotStyle ScottPlot.Plot.GetStyle ( )

Return the current style settings for this plot.

◆ GetSvgHtml()

string ScottPlot.Plot.GetSvgHtml ( int  width,
int  height 
)
inline

Render the plot and return a plain text SVG element suitable for insertion into HTML.

◆ GetSvgXml()

string ScottPlot.Plot.GetSvgXml ( int  width,
int  height 
)
inline

◆ HideAxesAndGrid()

void ScottPlot.Plot.HideAxesAndGrid ( bool  showTitle = true)
inline

Disable visibility for all axes and grids.

◆ HideGrid()

void ScottPlot.Plot.HideGrid ( )
inline

Disable visibility for all grids.

◆ HideLegend()

Legend ScottPlot.Plot.HideLegend ( )
inline

Helper method for setting visibility of the Legend

◆ MoveToBack()

void ScottPlot.Plot.MoveToBack ( IPlottable  plottable)
inline

Move the indicated plottable to the start of the list so it is rendered first.

◆ MoveToBottom()

void ScottPlot.Plot.MoveToBottom ( IPlottable  plottable)

Move the indicated plottable to the start of the list so it is rendered first and appears below all other plottables.

◆ MoveToFront()

void ScottPlot.Plot.MoveToFront ( IPlottable  plottable)
inline

Move the indicated plottable to the end of the list so it is rendered last.

◆ MoveToTop()

void ScottPlot.Plot.MoveToTop ( IPlottable  plottable)

Move the indicated plottable to the end of the list so it is rendered last and appears above all other plottables.

◆ Remove() [1/4]

void ScottPlot.Plot.Remove ( IAxis  axis)
inline

Remove the given Axis from the Axes.

◆ Remove() [2/4]

void ScottPlot.Plot.Remove ( IPanel  panel)
inline

Remove the given Panel from the Axes.

◆ Remove() [3/4]

void ScottPlot.Plot.Remove ( IPlottable  plottable)
inline

Remove the given plottable from the PlottableList.

◆ Remove() [4/4]

void ScottPlot.Plot.Remove ( Type  plotType)
inline

Remove all items of a specific type from the PlottableList.

◆ Remove< T >() [1/2]

void ScottPlot.Plot.Remove< T > ( )
inline

Remove a all instances of a specific type from the PlottableList.

Template Parameters
TType of IPlottable to be removed
Type Constraints
T :IPlottable 

◆ Remove< T >() [2/2]

void ScottPlot.Plot.Remove< T > ( Func< T, bool >  predicate)
inline

Remove all instances of a specific type from the PlottableList that meet the predicate criteraia.

Parameters
predicateA function to test each element for a condition.
Template Parameters
TType of IPlottable to be removed
Type Constraints
T :IPlottable 

◆ Render() [1/4]

void ScottPlot.Plot.Render ( int  width = 400,
int  height = 300 
)
inline

◆ Render() [2/4]

void ScottPlot.Plot.Render ( SKCanvas  canvas,
int  width,
int  height 
)
inline

Render onto an existing canvas with the given dimensions.

◆ Render() [3/4]

void ScottPlot.Plot.Render ( SKCanvas  canvas,
PixelRect  rect 
)
inline

Render onto an existing canvas inside the given rectangle.

◆ Render() [4/4]

void ScottPlot.Plot.Render ( SKSurface  surface)
inline

Render onto an existing canvas of a surface over the local clip bounds.

◆ RenderInMemory()

void ScottPlot.Plot.RenderInMemory ( int  width = 400,
int  height = 300 
)

Create a new image of the given dimensions, render the plot onto it, and return it.

◆ Save() [1/2]

SavedImageInfo ScottPlot.Plot.Save ( string  filePath,
int  width,
int  height 
)
inline

◆ Save() [2/2]

SavedImageInfo ScottPlot.Plot.Save ( string  filePath,
int  width,
int  height,
ImageFormat  format,
int  quality = 85 
)
inline

◆ SaveBmp()

SavedImageInfo ScottPlot.Plot.SaveBmp ( string  filePath,
int  width,
int  height 
)
inline

◆ SaveJpeg()

SavedImageInfo ScottPlot.Plot.SaveJpeg ( string  filePath,
int  width,
int  height,
int  quality = 85 
)
inline

◆ SavePng()

SavedImageInfo ScottPlot.Plot.SavePng ( string  filePath,
int  width,
int  height 
)
inline

◆ SaveSvg()

SavedImageInfo ScottPlot.Plot.SaveSvg ( string  filePath,
int  width,
int  height 
)
inline

◆ SaveWebp()

SavedImageInfo ScottPlot.Plot.SaveWebp ( string  filePath,
int  width,
int  height,
int  quality = 85 
)
inline

◆ SetStyle() [1/2]

void ScottPlot.Plot.SetStyle ( Plot  otherPlot)

Apply the style settings from the given plot to this plot.

◆ SetStyle() [2/2]

void ScottPlot.Plot.SetStyle ( PlotStyle  style)

Apply the given style settings to this plot.

◆ ShowGrid()

void ScottPlot.Plot.ShowGrid ( )
inline

Enable visibility for all grids.

◆ ShowLegend() [1/5]

Legend ScottPlot.Plot.ShowLegend ( )
inline

Helper method for setting visibility of the Legend

◆ ShowLegend() [2/5]

Legend ScottPlot.Plot.ShowLegend ( Alignment  alignment)
inline

Helper method for setting visibility of the Legend and setting Legend.Location to the provided one.

◆ ShowLegend() [3/5]

Legend ScottPlot.Plot.ShowLegend ( Alignment  alignment,
Orientation  orientation 
)
inline

Helper method for setting the Legend's IsVisible, Alignment, and Orientation properties all at once.

◆ ShowLegend() [4/5]

Panels.LegendPanel ScottPlot.Plot.ShowLegend ( Edge  edge)
inline

Hide the default legend (inside the data area) and create a new legend panel placed on the edge of the figure outside the data area.

Returns

◆ ShowLegend() [5/5]

Legend ScottPlot.Plot.ShowLegend ( IEnumerable< LegendItem items,
Alignment  location = Alignment::LowerRight 
)
inline

Helper method for displaying specific items in the legend.

◆ Title()

void ScottPlot.Plot.Title ( string  text,
float?  size = null 
)
inline

Shortcut to set text of the TitlePanel Label. Assign properties of TitlePanel Label to customize size, color, font, etc.

◆ XLabel()

void ScottPlot.Plot.XLabel ( string  label,
float?  size = null 
)
inline

Shortcut to set text of the BottomAxis Label Assign properties of BottomAxis Label to customize size, color, font, etc.

◆ YLabel()

void ScottPlot.Plot.YLabel ( string  label,
float?  size = null 
)
inline

Shortcut to set text of the BottomAxis Label Assign properties of BottomAxis Label to customize size, color, font, etc.

Member Data Documentation

◆ DataBackground

BackgroundStyle ScottPlot.Plot.DataBackground = new() { Color = Colors.Transparent }

Style for the data area (the area within the axis frames)

◆ FigureBackground

BackgroundStyle ScottPlot.Plot.FigureBackground = new() { Color = Colors.White }

Style for the background of the entire figure.

Property Documentation

◆ Add

PlottableAdder ScottPlot.Plot.Add
get

◆ Axes

AxisManager ScottPlot.Plot.Axes
get

◆ Benchmark

IPlottable ScottPlot.Plot.Benchmark = new Plottables.Benchmark()
getset

◆ Font

FontStyler ScottPlot.Plot.Font
get

◆ Grid

DefaultGrid ScottPlot.Plot.Grid
get

◆ LastRender

RenderDetails ScottPlot.Plot.LastRender
get

◆ Layout

LayoutManager ScottPlot.Plot.Layout
get

◆ Legend

Legend ScottPlot.Plot.Legend
getset

◆ PlotControl

IPlotControl? ScottPlot.Plot.PlotControl = null
getset

In GUI environments this property holds a reference to the interactive plot control.

◆ PlottableList

List<IPlottable> ScottPlot.Plot.PlottableList = []
get

◆ RenderManager

RenderManager ScottPlot.Plot.RenderManager
get

◆ ScaleFactor

double ScottPlot.Plot.ScaleFactor
getset

◆ Style

PlotStyler ScottPlot.Plot.Style = new()
get

◆ Sync

object ScottPlot.Plot.Sync = new()
get

This object is locked by the Render() methods. Logic that manipulates the plot (UI inputs or editing data) can lock this object to prevent rendering artifacts.

◆ ZoomRectangle

IZoomRectangle ScottPlot.Plot.ZoomRectangle
getset

The documentation for this class was generated from the following file: