Documentation ¶
Index ¶
- Constants
- Variables
- func BeginPlot(title string) bool
- func BeginPlotV(title string, size imgui.Vec2, flags Flags) bool
- func BeginSubplots(title string, rows, cols int) bool
- func BeginSubplotsV(title string, rows, cols int, size imgui.Vec2, flags SubplotFlags, ...) bool
- func EndPlot()
- func EndSubplots()
- func GetLastItemColor() imgui.Vec4
- func GetMarkerName(id Marker) string
- func GetStyleColorName(id StyleCol) string
- func PlotBarGroups(itemLabels []string, values [][]float64, groupWidth, x0 float64, ...)
- func PlotBarGroupsH(itemLabels []string, values [][]float64, groupWidth, y0 float64, ...)
- func PlotBars(label string, vs interface{})
- func PlotBarsG(label string, getter DataGetter, userData interface{}, count int, ...)
- func PlotBarsH(label string, vs interface{})
- func PlotBarsHG(label string, getter DataGetter, userData interface{}, count int, ...)
- func PlotBarsHP(label string, ps []Point, barHeight float64)
- func PlotBarsHV(label string, vs interface{}, barHeight, y0 float64)
- func PlotBarsHXY(label string, vx, vy interface{}, barHeight float64)
- func PlotBarsP(label string, ps []Point, barWidth float64)
- func PlotBarsV(label string, vs interface{}, barWidth, x0 float64)
- func PlotBarsXY(label string, vx, vy interface{}, barWidth float64)
- func PlotLine(label string, values interface{})
- func PlotLineG(label string, getter DataGetter, userData interface{}, count int)
- func PlotLineP(label string, points []Point)
- func PlotLineV(label string, values interface{}, xscale, x0 float64)
- func PlotLineXY(label string, xs, ys interface{})
- func PlotScatter(label string, values interface{})
- func PlotScatterG(label string, getter DataGetter, userData interface{}, count int)
- func PlotScatterP(label string, points []Point)
- func PlotScatterV(label string, values interface{}, xscale, x0 float64)
- func PlotScatterXY(label string, xs, ys interface{})
- func PlotShadedLines(label string, vs0, vs1 interface{})
- func PlotShadedLinesG(label string, get1 DataGetter, data1 interface{}, get2 DataGetter, ...)
- func PlotShadedLinesV(label string, vs0, vs1 interface{}, xscale, x0 float64)
- func PlotShadedLinesXY(label string, xs, ys1, ys2 interface{})
- func PlotShadedRef(label string, values interface{})
- func PlotShadedRefG(label string, getter DataGetter, userData interface{}, count int, yref float64)
- func PlotShadedRefP(label string, points []Point, yref float64)
- func PlotShadedRefV(label string, values interface{}, yref, xscale, x0 float64)
- func PlotShadedRefXY(label string, xs, ys interface{}, yref float64)
- func PlotStairs(label string, values interface{})
- func PlotStairsG(label string, getter DataGetter, userData interface{}, count int)
- func PlotStairsP(label string, points []Point)
- func PlotStairsV(label string, values interface{}, xscale, x0 float64)
- func PlotStairsXY(label string, xs, ys interface{})
- func PopStyleColor()
- func PopStyleColorV(count int)
- func PopStyleVar()
- func PopStyleVarV(count int)
- func PushStyleColor(id StyleCol, color imgui.Vec4)
- func PushStyleVar(v StyleVar, val interface{})
- func PushStyleVarFloat(v StyleVar, val float32)
- func PushStyleVarInt(v StyleVar, val int)
- func PushStyleVarVec2(v StyleVar, val imgui.Vec2)
- func SetImGUIContext(ig *imgui.Context)
- func SetNextErrorBarStyle(color imgui.Vec4, size, weight float32)
- func SetNextFillStyle(color imgui.Vec4, alpha float32)
- func SetNextLineStyle(color imgui.Vec4, weight float32)
- func SetNextMarkerStyle(marker Marker, size float32, fillColor imgui.Vec4, outlineWeight float32, ...)
- func SetupAxes(xlabel, ylabel string, xflags, yflags AxisFlags)
- func SetupAxesLimits(xmin, xmax, ymin, ymax float64, cond Condition)
- func SetupAxis(axis Axis, label string, flags AxisFlags)
- func SetupAxisFormat(axis Axis, fmt string)
- func SetupAxisFormatCallback(axis Axis, formatter Formatter, userData interface{})
- func SetupAxisLimits(axis Axis, vmin, vmax float64, cond Condition)
- func SetupAxisTickRange(axis Axis, vmin, vmax float64, n int, labels []string, keepDefaults bool)
- func SetupAxisTickValues(axis Axis, values []float64, labels []string, keepDefaults bool)
- func SetupFinish()
- func SetupLegend(location Location, flags LegendFlags)
- func SetupMouseText(location Location, flags MouseTextFlags)
- func ShowDemoWindow(open *bool)
- func StyleColorsAuto()
- func StyleColorsClassic()
- func StyleColorsDark()
- func StyleColorsLight()
- func Version() string
- type Axis
- type AxisFlags
- type BarGroupsFlags
- type Bin
- type Colormap
- type Condition
- type Context
- type DataGetter
- type DragToolFlags
- type Flags
- type Formatter
- type LegendFlags
- type Location
- type Marker
- type MouseTextFlags
- type Point
- type Range
- type Rect
- type Style
- func (s Style) Color(color StyleCol) imgui.Vec4
- func (s Style) SetColor(color StyleCol, to imgui.Vec4)
- func (s Style) SetVar(v StyleVar, to interface{})
- func (s Style) SetVarFloat(v StyleVar, to float32)
- func (s Style) SetVarInt(v StyleVar, to int)
- func (s Style) SetVarVec2(v StyleVar, to imgui.Vec2)
- func (s Style) Var(v StyleVar) interface{}
- func (s Style) VarFloat(v StyleVar) float32
- func (s Style) VarInt(v StyleVar) int
- func (s Style) VarVec2(v StyleVar) imgui.Vec2
- type StyleCol
- type StyleVar
- type SubplotFlags
Constants ¶
const ( Condition_None = Condition(imgui.ConditionNone) // No condition (always set the variable), same as _Always Condition_Always = Condition(imgui.ConditionAlways) // No condition (always set the variable) Condition_Once = Condition(imgui.ConditionOnce) // Set the variable once per runtime session (only the first call will succeed) )
Represents a condition for SetupAxisLimits etc. (a subset of imgui.Cond)
const ( Location_North Location = 1 << iota // top-center Location_South // bottom-center Location_West // center-left Location_East // center-right Location_Center = 0 // center-center Location_NorthWest = Location_North | Location_West // top-left Location_NorthEast = Location_North | Location_East // top-right Location_SouthWest = Location_South | Location_West // bottom-left Location_SouthEast = Location_South | Location_East // bottom-right )
Locations used to position items on a plot
const ( Bin_Sqrt Bin = -1 // k = sqrt(n) Bin_Sturges = -2 // k = 1 + log2(n) Bin_Rice = -3 // k = 2 * cbrt(n) Bin_Scott = -4 // w = 3.49 * sigma / cbrt(n) )
Different automatic histogram binning methods (k = bin count or w = bin width)
Variables ¶
var Auto float32 = -1
Special auto value. Used in sizes, width, etc.
var AutoColor = imgui.Vec4{X: 0, Y: 0, Z: 0, W: -1}
Special color used to indicate that a color should be deduced automatically.
var ErrContextDestroyed = errors.New("context is destroyed")
ErrContextDestroyed is returned when trying to use an already destroyed context. It should not be the same with imgui.ErrContextDestroyed.
var ErrNoContext = errors.New("no current context")
ErrNoContext is used when no context is current. It should not be the same with imgui.ErrNoContext.
Functions ¶
func BeginPlot ¶
BeginPlot starts a 2D plotting context with only the title specified. It calls BeginPlotV(title, Vec2{-1, 0}, Flags_None).
If this function returns true, then EndPlot() MUST be called! You can do:
if igwrap.BeginPlot(...) { igwrap.PlotXXX(...) ... igwrap.EndPlot() }
Note that:
- title must be unique to the current ImGui ID scope. If you need to avoid ID collisions or don't want to display a title in the plot, use double hashes (e.g. "MyPlot##HiddenIdText" or "##NoTitle").
- size is the **frame** size of the plot widget, not the plot area. The default size of plots (i.e. when ImVec2(0,0)) can be modified in your ImPlotStyle.
func BeginPlotV ¶
BeginPlotV starts a 2D plotting context with all the parameters specified.
If this function returns true, then EndPlot() MUST be called! You can do:
if igwrap.BeginPlot(...) { igwrap.PlotXXX(...) ... igwrap.EndPlot() }
Note that:
- title must be unique to the current ImGui ID scope. If you need to avoid ID collisions or don't want to display a title in the plot, use double hashes (e.g. "MyPlot##HiddenIdText" or "##NoTitle").
- size is the **frame** size of the plot widget, not the plot area. The default size of plots (i.e. when ImVec2(0,0)) can be modified in your ImPlotStyle.
func BeginSubplots ¶
BeginSubplots starts a subdivided plotting context with onle the required parameters. It calls BeginSubplotsV(title, rows, cols, Vec2{-1, 0}, SubplotFlags_None, nil, nil).
If the function returns true, EndSubplots() MUST be called! Call BeginPlot/EndPlot AT MOST [rows*cols] times in between the begining and end of the subplot context. Plots are added in row major order. Example:
if BeginSubplots("My Subplot",2,3) { for i := 0; i < 6; i++ { if BeginPlot(...) { PlotLine(...); ... EndPlot(); } } EndSubplots(); }
Produces:
[0] | [1] | [2] ----|-----|---- [3] | [4] | [5]
Important notes:
- #title must be unique to the current ImGui ID scope. If you need to avoid ID collisions or don't want to display a title in the plot, use double hashes (e.g. "MySubplot##HiddenIdText" or "##NoTitle").
- #rows and #cols must be greater than 0.
- #size is the size of the entire grid of subplots, not the individual plots
- #row_ratios and #col_ratios must have AT LEAST #rows and #cols elements, respectively. These are the sizes of the rows and columns expressed in ratios. If the user adjusts the dimensions, the arrays are updated with new ratios.
Important notes regarding BeginPlot from inside of BeginSubplots:
- The #title parameter of _BeginPlot_ (see above) does NOT have to be unique when called inside of a subplot context. Subplot IDs are hashed for your convenience so you don't have call PushID or generate unique title strings. Simply pass an empty string to BeginPlot unless you want to title each subplot.
- The #size parameter of _BeginPlot_ (see above) is ignored when inside of a subplot context. The actual size of the subplot will be based on the #size value you pass to _BeginSubplots_ and #row/#col_ratios if provided.
func BeginSubplotsV ¶
func BeginSubplotsV(title string, rows, cols int, size imgui.Vec2, flags SubplotFlags, rowRatios, colRatios []float32) bool
BeginSubplotsV starts a subdivided plotting context with all parameters.
If the function returns true, EndSubplots() MUST be called! Call BeginPlot/EndPlot AT MOST [rows*cols] times in between the begining and end of the subplot context. Plots are added in row major order. Example:
if BeginSubplots("My Subplot",2,3) { for i := 0; i < 6; i++ { if BeginPlot(...) { PlotLine(...); ... EndPlot(); } } EndSubplots(); }
Produces:
[0] | [1] | [2] ----|-----|---- [3] | [4] | [5]
Important notes:
- #title must be unique to the current ImGui ID scope. If you need to avoid ID collisions or don't want to display a title in the plot, use double hashes (e.g. "MySubplot##HiddenIdText" or "##NoTitle").
- #rows and #cols must be greater than 0.
- #size is the size of the entire grid of subplots, not the individual plots
- #row_ratios and #col_ratios must have AT LEAST #rows and #cols elements, respectively. These are the sizes of the rows and columns expressed in ratios. If the user adjusts the dimensions, the arrays are updated with new ratios.
Important notes regarding BeginPlot from inside of BeginSubplots:
- The #title parameter of _BeginPlot_ (see above) does NOT have to be unique when called inside of a subplot context. Subplot IDs are hashed for your convenience so you don't have call PushID or generate unique title strings. Simply pass an empty string to BeginPlot unless you want to title each subplot.
- The #size parameter of _BeginPlot_ (see above) is ignored when inside of a subplot context. The actual size of the subplot will be based on the #size value you pass to _BeginSubplots_ and #row/#col_ratios if provided.
func EndPlot ¶
func EndPlot()
EndPlot marks the end of an active plot.
Only call EndPlot() if BeginPlot() returns true! Typically called at the end of an if statement conditioned on BeginPlot(). See example above.
func EndSubplots ¶
func EndSubplots()
EndSubplots marks the end of a subdivided plotting area.
Only call EndSubplots() if BeginSubplots() returns true! Typically called at the end of an if statement conditioned on BeginSublots(). See example above.
func GetLastItemColor ¶
func GetLastItemColor() imgui.Vec4
GetLastItemColor returns the primary color of the last item (i.e. its legend icon color)
func GetMarkerName ¶
GetMarkerName returns the name of a marker.
func GetStyleColorName ¶
GetStyleColorName returns the name of a style color.
func PlotBarGroups ¶
func PlotBarGroups(itemLabels []string, values [][]float64, groupWidth, x0 float64, flags BarGroupsFlags)
PlotBarGroups plots a group of vertical bars.
The I-th item in the J-th group is in #values[I][J]. The I-th item has a legend label of #itemLabels[I].
Item count N = Min(len(itemLabels), len(values)). Group count M = Min(len(values[0]), len(values[1]), ... len(values[N-1])).
The bar groups are centered at at x0, x0+1, x0+2, x0+M-1. If you want to put labels on the groups, use SetupAxisTickValues.
func PlotBarGroupsH ¶
func PlotBarGroupsH(itemLabels []string, values [][]float64, groupWidth, y0 float64, flags BarGroupsFlags)
PlotBarGroupsH plots a group of horizontal bars.
The I-th item in the J-th group is in #values[I][J]. The I-th item has a legend label of #itemLabels[I].
Item count N = Min(len(itemLabels), len(values)). Group count M = Min(len(values[0]), len(values[1]), ... len(values[N-1])).
The bar groups are centered at at y0, y0+1, y0+2, y0+M-1. If you want to put labels on the groups, use SetupAxisTickValues.
func PlotBars ¶
func PlotBars(label string, vs interface{})
PlotBars plots a vertical bar graph, with every bar centering at X coords 0, 1, ..., N-1.
func PlotBarsG ¶
func PlotBarsG(label string, getter DataGetter, userData interface{}, count int, barWidth float64)
PlotBarsG plots a vertical bar graph, with bars each taking up a fraction of the available width. #barWidth should be in (0, 1].
func PlotBarsH ¶
func PlotBarsH(label string, vs interface{})
PlotBarsH plots a horizontal bar graph, with every bar centering at Y coords 0, 1, ..., N-1.
func PlotBarsHG ¶
func PlotBarsHG(label string, getter DataGetter, userData interface{}, count int, barHeight float64)
PlotBarsHG plots a horizontal bar graph, with bars each taking up a fraction of the available height. #barHeight should be in (0, 1].
func PlotBarsHP ¶
PlotBarsHP plots a horizontal bar graph, with bars each taking up a fraction of the available height. #barHeight should be in (0, 1].
func PlotBarsHV ¶
PlotBarsHV plots a horizontal bar graph, with bars centering at y0, y0+1, y0+2, ... y0+N-1, Each taking up a fraction of the available height. #barHeight should be in (0, 1].
func PlotBarsHXY ¶
PlotBarsHXY plots a horizontal bar graph, with bars each taking up a fraction of the available height. #barHeight should be in (0, 1].
func PlotBarsP ¶
PlotBarsP plots a vertical bar graph, with bars each taking up a fraction of the available width. #barWidthFraction should be in (0, 1].
func PlotBarsV ¶
PlotBarsV plots a vertical bar graph, with bars centering at x0, x0+1, x0+2, ... x0+N-1, Each taking up a fraction of the available width. #barWidth should be in (0, 1].
func PlotBarsXY ¶
PlotBarsXY plots a vertical bar graph, with bars each taking up a fraction of the available width. #barWidth should be in (0, 1].
func PlotLine ¶
func PlotLine(label string, values interface{})
PlotLine plots a standard 2D line plot with minimal parameters. It calls PlotLineV(label, values, 1, 0).
func PlotLineG ¶
func PlotLineG(label string, getter DataGetter, userData interface{}, count int)
PlotLineG plots a standard 2D line plot from a series of points obtained from a callback.
func PlotLineXY ¶
func PlotLineXY(label string, xs, ys interface{})
PlotLineXY plots a standard 2D line plot from slices of X/Y coords.
func PlotScatter ¶
func PlotScatter(label string, values interface{})
PlotScatter plots a standard 2D scatter plot with minimal parameters. It calls PlotScatterV(label, values, 1, 0).
Default marker is ImPlotMarker_Circle.
func PlotScatterG ¶
func PlotScatterG(label string, getter DataGetter, userData interface{}, count int)
PlotScatterG plots a standard 2D scatter plot from a series of points obtained from a callback.
Default marker is ImPlotMarker_Circle.
func PlotScatterP ¶
PlotScatterP plots a standard 2D scatter plot from a slice of points.
Default marker is ImPlotMarker_Circle.
func PlotScatterV ¶
PlotScatterV plots a standard 2D scatter plot with all parameters.
Default marker is ImPlotMarker_Circle.
func PlotScatterXY ¶
func PlotScatterXY(label string, xs, ys interface{})
PlotScatterXY plots a standard 2D scatter plot from slices of X/Y coords.
Default marker is ImPlotMarker_Circle.
func PlotShadedLines ¶
func PlotShadedLines(label string, vs0, vs1 interface{})
PlotShadedLines plots a shaded (filled) region between two lines, without the lines themselves. It calls PlotShadedLinesV(label, vs0, vs1, 1, 0).
func PlotShadedLinesG ¶
func PlotShadedLinesG(label string, get1 DataGetter, data1 interface{}, get2 DataGetter, data2 interface{}, count int)
PlotShadedLinesG plots a shaded (filled) region between two lines, without the lines themselves.
The X component of the second getter is discarded.
func PlotShadedLinesV ¶
PlotShadedLinesV plots a shaded (filled) region between two lines, without the lines themselves.
func PlotShadedLinesXY ¶
func PlotShadedLinesXY(label string, xs, ys1, ys2 interface{})
PlotShadedLinesXY plots a shaded (filled) region between two lines, without the lines themselves.
func PlotShadedRef ¶
func PlotShadedRef(label string, values interface{})
PlotShadedRef plots a shaded (filled) region between a line and a horizontal reference. It calls PlotShadedV(label, values, 0, 1, 0).
func PlotShadedRefG ¶
func PlotShadedRefG(label string, getter DataGetter, userData interface{}, count int, yref float64)
PlotShadedRefG plots a shaded (filled) region between a line and a horizontal reference.
Set yref to +/-INFINITY for infinite fill extents.
func PlotShadedRefP ¶
PlotShadedRefP plots a shaded (filled) region between a line and a horizontal reference.
Set yref to +/-INFINITY for infinite fill extents.
func PlotShadedRefV ¶
PlotShadedRefV plots a shaded (filled) region between a line and a horizontal reference.
Set yref to +/-INFINITY for infinite fill extents.
func PlotShadedRefXY ¶
PlotShadedRefXY plots a shaded (filled) region between a line and a horizontal reference.
Set yref to +/-INFINITY for infinite fill extents.
func PlotStairs ¶
func PlotStairs(label string, values interface{})
PlotStairs plots a stairstep graph with minimal parameters. It calls PlotStairsV(label, values, 1, 0).
The y value is continued constantly from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i].
func PlotStairsG ¶
func PlotStairsG(label string, getter DataGetter, userData interface{}, count int)
PlotStairsG plots a stairstep graph from a series of points obtained from a callback.
The y value is continued constantly from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i].
func PlotStairsP ¶
PlotStairsP plots a stairstep graph from a slice of points.
The y value is continued constantly from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i].
func PlotStairsV ¶
PlotStairsV plots a stairstep graph with all parameters. Default marker is ImPlotMarker_Circle.
The y value is continued constantly from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i].
func PlotStairsXY ¶
func PlotStairsXY(label string, xs, ys interface{})
PlotStairsXY plots a stairstep graph from slices of X/Y coords.
The y value is continued constantly from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i].
func PopStyleColor ¶
func PopStyleColor()
PopStyleColor pops one color off the style stack. It calls PopStyleColorV(1).
func PopStyleColorV ¶
func PopStyleColorV(count int)
PopStyleColorV pops #count colors off the stack.
func PopStyleVar ¶
func PopStyleVar()
PopStyleVar pops one variable off the stack. It calls PopStyleVarV(1).
func PushStyleColor ¶
func PushStyleColor(id StyleCol, color imgui.Vec4)
PushStyleColor pushes the given color onto the stack.
You MUST call a pop for every push, otherwise you will leak memory! This behaves just like ImGui itself.
func PushStyleVar ¶
func PushStyleVar(v StyleVar, val interface{})
PushStyleVar pushes a given style variable onto the stack.
If the types of #v and #val mismatch, it panics.
You MUST call a pop for every push, otherwise you will leak memory! This behaves just like ImGui itself.
func PushStyleVarFloat ¶
PushStyleVarFloat pushes a given style variable of float onto the stack.
If the type of #v mismatch, it panics.
You MUST call a pop for every push, otherwise you will leak memory! This behaves just like ImGui itself.
func PushStyleVarInt ¶
PushStyleVarInt pushes a given style variable of int onto the stack.
If the type of #v mismatch, it panics.
You MUST call a pop for every push, otherwise you will leak memory! This behaves just like ImGui itself.
func PushStyleVarVec2 ¶
func PushStyleVarVec2(v StyleVar, val imgui.Vec2)
PushStyleVarVec2 pushes a given style variable of ImVec2 onto the stack.
If the type of #v mismatch, it panics.
You MUST call a pop for every push, otherwise you will leak memory! This behaves just like ImGui itself.
func SetImGUIContext ¶
func SetImGUIContext(ig *imgui.Context)
SetImGUIContext sets the current ImGUI context for ImPlot.
It should not be used, at least with the current way Go links libraries.
func SetNextErrorBarStyle ¶
func SetNextErrorBarStyle(color imgui.Vec4, size, weight float32)
SetNextErrorBarStyle set the error bar style for the next item only.
All the values can be set to Auto/AutoColor to deduce from the current Style and Colormap data.
func SetNextFillStyle ¶
func SetNextFillStyle(color imgui.Vec4, alpha float32)
SetNextLineStyle set the the fill color for the next item only.
All the values can be set to Auto/AutoColor to deduce from the current Style and Colormap data.
func SetNextLineStyle ¶
func SetNextLineStyle(color imgui.Vec4, weight float32)
SetNextLineStyle set the line color and weight for the next item only.
All the values can be set to Auto/AutoColor to deduce from the current Style and Colormap data.
func SetNextMarkerStyle ¶
func SetNextMarkerStyle(marker Marker, size float32, fillColor imgui.Vec4, outlineWeight float32, outlineColor imgui.Vec4)
SetNextMarkerStyle set the marker style for the next item only.
All the values can be set to Auto/AutoColor to deduce from the current Style and Colormap data.
func SetupAxes ¶
SetupAxes sets the label and/or flags for primary X and Y axes. (shorthand for two calls to SetupAxis)
func SetupAxesLimits ¶
SetupAxesLimits sets the primary X and Y axes range limits. If ImPlotCond_Always is used, the axes limits will be locked. (shorthand for two calls to SetupAxisLimits)
func SetupAxisFormat ¶
SetupAxisFormat sets the format of numeric axis labels via formater specifier (default="%g"). The formatted value will be C.double, and you can also use %f.
func SetupAxisFormatCallback ¶
SetupAxisFormatCallback sets the format of numeric axis labels via formatter callback.
The userData value will be discarded on every EndPlot, so hopefully this will not cause a memory leak.
func SetupAxisLimits ¶
SetupAxisLimits sets an axis range limits. If ImPlotCond_Always is used, the axes limits will be locked.
Note that SetupAxisLinks() is absent. I don't really know how to implement that.
func SetupAxisTickRange ¶
SetupAxisTickRange set an axis' tick values (n of them from [vmin, vmax]) and labels. Labels are optional and can be set default with labels=nil.
To keep the default ticks, set keep_default=true.
func SetupAxisTickValues ¶
SetupAxisTickValues set an axis' tick values (as given in the slice) and labels. Labels are optional and can be set default with labels=nil.
To keep the default ticks, set keep_default=true.
Note that if len(values)!=len(labels), it takes len(values).
func SetupFinish ¶
func SetupFinish()
SetupFinish explicitly finalize plot setup. Once you call this, you cannot make anymore Setup calls for the current plot!
Note that calling this function is OPTIONAL; it will be called by the first subsequent setup-locking API call.
func SetupLegend ¶
func SetupLegend(location Location, flags LegendFlags)
SetupLegend sets up the position and flags of the plot legend.
func SetupMouseText ¶
func SetupMouseText(location Location, flags MouseTextFlags)
SetupMouseText sets up location of the current plot's mouse position text (the tiny xxx,yyy numbers on the plot). The default is South|East (so bottom-right).
func StyleColorsAuto ¶
func StyleColorsAuto()
StyleColorsAuto sets all global style colors to be automatically deduced from the current ImGui style.
func StyleColorsClassic ¶
func StyleColorsClassic()
StyleColorsClassic sets the global style colors to mimic the ImGui "Classic" style.
func StyleColorsDark ¶
func StyleColorsDark()
StyleColorsDark sets the global style colors to mimic the ImGui "Dark" style.
func StyleColorsLight ¶
func StyleColorsLight()
StyleColorsLight sets the global style colors to mimic the ImGui "Light" style.
Types ¶
type AxisFlags ¶
const ( AxisFlags_NoLabel AxisFlags = 1 << iota // the axis label will not be displayed (axis labels also hidden if the supplied string name is NULL) AxisFlags_NoGridLines // no grid lines will be displayed AxisFlags_NoTickMarks // no tick marks will be displayed AxisFlags_NoTickLabels // no text labels will be displayed AxisFlags_NoInitialFit // axis will not be initially fit to data extents on the first rendered frame AxisFlags_NoMenus // the user will not be able to open context menus with right-click AxisFlags_Opposite // axis ticks and labels will be rendered on conventionally opposite side (i.e, right or top) AxisFlags_Foreground // grid lines will be displayed in the foreground (i.e. on top of data) in stead of the background AxisFlags_LogScale // a logartithmic (base 10) axis scale will be used (mutually exclusive with ImPlotAxisFlags_Time) AxisFlags_Time // axis will display date/time formatted labels (mutually exclusive with ImPlotAxisFlags_LogScale) AxisFlags_Invert // the axis will be inverted AxisFlags_AutoFit // axis will be auto-fitting to data extents AxisFlags_RangeFit // axis will only fit points if the point is in the visible range of the **orthogonal** axis AxisFlags_LockMin // the axis minimum value will be locked when panning/zooming AxisFlags_LockMax // the axis maximum value will be locked when panning/zooming AxisFlags_None = 0 // default AxisFlags_Lock = AxisFlags_LockMin | AxisFlags_LockMax AxisFlags_NoDecorations = AxisFlags_NoLabel | AxisFlags_NoGridLines | AxisFlags_NoTickMarks | AxisFlags_NoTickLabels AxisFlags_AuxDefault = AxisFlags_NoGridLines | AxisFlags_Opposite )
Flags for plot axes / SetupAxis
type BarGroupsFlags ¶
const ( BarGroupsFlags_Stacked BarGroupsFlags = 1 << iota // items in a group will be stacked on top of each other BarGroupsFlags_None = 0 // default )
Flags for PlotBarGroups
type Colormap ¶
const ( Colormap_Deep Colormap = iota // a.k.a. seaborn deep (qual=true, n=10) (default) Colormap_Dark // a.k.a. matplotlib "Set1" (qual=true, n=9 ) Colormap_Pastel // a.k.a. matplotlib "Pastel1" (qual=true, n=9 ) Colormap_Paired // a.k.a. matplotlib "Paired" (qual=true, n=12) Colormap_Viridis // a.k.a. matplotlib "viridis" (qual=false, n=11) Colormap_Plasma // a.k.a. matplotlib "plasma" (qual=false, n=11) Colormap_Hot // a.k.a. matplotlib/MATLAB "hot" (qual=false, n=11) Colormap_Cool // a.k.a. matplotlib/MATLAB "cool" (qual=false, n=11) Colormap_Pink // a.k.a. matplotlib/MATLAB "pink" (qual=false, n=11) Colormap_Jet // a.k.a. MATLAB "jet" (qual=false, n=11) Colormap_Twilight // a.k.a. matplotlib "twilight" (qual=false, n=11) Colormap_RdBu // red/blue, Color Brewer (qual=false, n=11) Colormap_BrBG // brown/blue-green, Color Brewer (qual=false, n=11) Colormap_PiYG // pink/yellow-green, Color Brewer (qual=false, n=11) Colormap_Spectral // color spectrum, Color Brewer (qual=false, n=11) Colormap_Greys // white/black (qual=false, n=2 ) )
Built-in colormaps
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context specifies a scope; a global state for ImPlot.
func CreateContext ¶
func CreateContext() *Context
CreateContext creates a new ImPlot context. It should be called right after imgui.CreateContext().
func CurrentContext ¶
CurrentContext returns the currently active context. Returns ErrNoContext if no context is available.
func (*Context) Destroy ¶
func (c *Context) Destroy()
Destroy deletes the context. Destroying an already destroyed context does nothing.
func (*Context) SetCurrent ¶
SetCurrent activates this context as the current active one.
type DataGetter ¶
Callback signature for the data getter.
It is called from within PlotXXXG() (the word "within" is subject to change), with idx ranging from 0 to N-1.
type DragToolFlags ¶
const ( DragToolFlags_NoCursors DragToolFlags = 1 << iota // drag tools won't change cursor icons when hovered or held DragToolFlags_NoFit // the drag tool won't be considered for plot fits DragToolFlags_NoInputs // lock the tool from user inputs DragToolFlags_Delayed // tool rendering will be delayed one frame; useful when applying position-constraints DragToolFlags_None = 0 // default )
Flags for DragPoint, DragLine, DragRect
type Flags ¶
const ( Flags_NoTitle Flags = 1 << iota // the plot title will not be displayed (titles are also hidden if preceeded by double hashes, e.g. "##MyPlot") Flags_NoLegend // the legend will not be displayed Flags_NoMouseText // the mouse position, in plot coordinates, will not be displayed inside of the plot Flags_NoInputs // the user will not be able to interact with the plot Flags_NoMenus // the user will not be able to open context menus Flags_NoBoxSelect // the user will not be able to box-select Flags_NoChild // a child window region will not be used to capture mouse scroll (can boost performance for single ImGui window applications) Flags_NoFrame // the ImGui frame will not be rendered Flags_Equal // x and y axes pairs will be constrained to have the same units/pixel Flags_Crosshairs // the default mouse cursor will be replaced with a crosshair when hovered Flags_AntiAliased // plot items will be software anti-aliased (not recommended for high density plots, prefer MSAA) Flags_None = 0 // default Flags_CanvasOnly = Flags_NoTitle | Flags_NoLegend | Flags_NoMenus | Flags_NoBoxSelect | Flags_NoMouseText )
Flags for plots / BeginPlot
type LegendFlags ¶
const ( LegendFlags_NoButtons LegendFlags = 1 << iota // legend icons will not function as hide/show buttons LegendFlags_NoHighlightItem // plot items will not be highlighted when their legend entry is hovered LegendFlags_NoHighlightAxis // axes will not be highlighted when legend entries are hovered (only relevant if x/y-axis count > 1) LegendFlags_NoMenus // the user will not be able to open context menus with right-click LegendFlags_Outside // legend will be rendered outside of the plot area LegendFlags_Horizontal // legend entries will be displayed horizontally LegendFlags_None = 0 // default )
Flags for legends / SetupLegend
type Marker ¶
const ( Marker_Circle Marker = iota // a circle marker Marker_Square // a square maker Marker_Diamond // a diamond marker Marker_Up // an upward-pointing triangle marker Marker_Down // an downward-pointing triangle marker Marker_Left // an leftward-pointing triangle marker Marker_Right // an rightward-pointing triangle marker Marker_Cross // a cross marker (not fillable) Marker_Plus // a plus marker (not fillable) Marker_Asterisk // a asterisk marker (not fillable) Marker_Count Marker_None = -1 // no marker )
Markers
type MouseTextFlags ¶
const ( MouseTextFlags_NoAuxAxes MouseTextFlags = 1 << iota // only show the mouse position for primary axes MouseTextFlags_NoFormat // axes label formatters won't be used to render text MouseTextFlags_ShowAlways // always display mouse position even if plot not hovered MouseTextFlags_None = 0 // default )
Flags for mouse hover text / SetupMouseText
type Point ¶
type Point struct {
X, Y float64
}
Point is a double-precision imgui.Vec2 for ImPlot.
func DataGet ¶
func DataGet(getter DataGetter, userData interface{}, count int) (ps []Point)
DataGet generates a slice of Points from a given DataGetter.
This puts a lot of stress on the allocator/GC so perhaps we need something else. This still can be useful for the end user however.
type Rect ¶
type Rect struct {
X, Y Range
}
Rect is a combination of two range limits for X and Y axes.
func RectFromAABB ¶
RectFromAABB constucts a Rect from a min/max point pair.
type Style ¶
type Style struct {
// contains filtered or unexported fields
}
Style contains plotting style data.
Right now this struct doesn't have much point, since there's only one style (the global one) accessible, and you can't create any.
func (Style) SetVar ¶
SetVar sets one of the variables of the style.
#to must be either a float32, a imgui.Vec2, or a int. If the types mismatch, it panics.
func (Style) SetVarFloat ¶
SetVarFloat sets a float style variable.
func (Style) SetVarVec2 ¶
SetVarVec2 sets a ImVec2 style variable.
func (Style) Var ¶
Var returns one of the variables of the style. Returns either a float32, a imgui.Vec2, or a int.
type StyleCol ¶
const ( // item styling colors StyleCol_Line StyleCol = iota // plot line/outline color (defaults to next unused color in current colormap) StyleCol_Fill // plot fill color for bars (defaults to the current line color) StyleCol_MarkerOutline // marker outline color (defaults to the current line color) StyleCol_MarkerFill // marker fill color (defaults to the current line color) StyleCol_ErrorBar // error bar color (defaults to ImGuiCol_Text) // plot styling colors StyleCol_FrameBg // plot frame background color (defaults to ImGuiCol_FrameBg) StyleCol_PlotBg // plot area background color (defaults to ImGuiCol_WindowBg) StyleCol_PlotBorder // plot area border color (defaults to ImGuiCol_Border) StyleCol_LegendBg // legend background color (defaults to ImGuiCol_PopupBg) StyleCol_LegendBorder // legend border color (defaults to ImPlotCol_PlotBorder) StyleCol_LegendText // legend text color (defaults to ImPlotCol_InlayText) StyleCol_TitleText // plot title text color (defaults to ImGuiCol_Text) StyleCol_InlayText // color of text appearing inside of plots (defaults to ImGuiCol_Text) StyleCol_AxisText // axis label and tick lables color (defaults to ImGuiCol_Text) StyleCol_AxisGrid // axis grid color (defaults to 25% ImPlotCol_AxisText) StyleCol_AxisTick // axis tick color (defaults to AxisGrid) StyleCol_AxisBg // background color of axis hover region (defaults to transparent) StyleCol_AxisBgHovered // axis hover color (defaults to ImGuiCol_ButtonHovered) StyleCol_AxisBgActive // axis active color (defaults to ImGuiCol_ButtonActive) StyleCol_Selection // box-selection color (defaults to yellow) StyleCol_Crosshairs // crosshairs color (defaults to ImPlotCol_PlotBorder) StyleCol_Count )
Plot styling colors
type StyleVar ¶
const ( // item styling variables StyleVar_LineWeight StyleVar = iota // float, plot item line weight in pixels StyleVar_Marker // int, marker specification StyleVar_MarkerSize // float, marker size in pixels (roughly the marker's "radius") StyleVar_MarkerWeight // float, plot outline weight of markers in pixels StyleVar_FillAlpha // float, alpha modifier applied to all plot item fills StyleVar_ErrorBarSize // float, error bar whisker width in pixels StyleVar_ErrorBarWeight // float, error bar whisker weight in pixels StyleVar_DigitalBitHeight // float, digital channels bit height (at 1) in pixels StyleVar_DigitalBitGap // float, digital channels bit padding gap in pixels // plot styling variables StyleVar_PlotBorderSize // float, thickness of border around plot area StyleVar_MinorAlpha // float, alpha multiplier applied to minor axis grid lines StyleVar_MajorTickLen // ImVec2, major tick lengths for X and Y axes StyleVar_MinorTickLen // ImVec2, minor tick lengths for X and Y axes StyleVar_MajorTickSize // ImVec2, line thickness of major ticks StyleVar_MinorTickSize // ImVec2, line thickness of minor ticks StyleVar_MajorGridSize // ImVec2, line thickness of major grid lines StyleVar_MinorGridSize // ImVec2, line thickness of minor grid lines StyleVar_PlotPadding // ImVec2, padding between widget frame and plot area, labels, or outside legends (i.e. main padding) StyleVar_LabelPadding // ImVec2, padding between axes labels, tick labels, and plot edge StyleVar_LegendPadding // ImVec2, legend padding from plot edges StyleVar_LegendInnerPadding // ImVec2, legend inner padding from legend edges StyleVar_LegendSpacing // ImVec2, spacing between legend entries StyleVar_MousePosPadding // ImVec2, padding between plot edge and interior info text StyleVar_AnnotationPadding // ImVec2, text padding around annotation labels StyleVar_FitPadding // ImVec2, additional fit padding as a percentage of the fit extents (e.g. ImVec2(0.1f,0.1f) adds 10% to the fit extents of X and Y) StyleVar_PlotDefaultSize // ImVec2, default size used when ImVec2(0,0) is passed to BeginPlot StyleVar_PlotMinSize // ImVec2, minimum size plot frame can be when shrunk StyleVar_Count )
Plot styling variables
type SubplotFlags ¶
const ( SubplotFlags_NoTitle SubplotFlags = 1 << iota // the subplot title will not be displayed (titles are also hidden if preceeded by double hashes, e.g. "##MySubplot") SubplotFlags_NoLegend // the legend will not be displayed (only applicable if ImPlotSubplotFlags_ShareItems is enabled) SubplotFlags_NoMenus // the user will not be able to open context menus with right-click SubplotFlags_NoResize // resize splitters between subplot cells will be not be provided SubplotFlags_NoAlign // subplot edges will not be aligned vertically or horizontally SubplotFlags_LinkRows // link the y-axis limits of all plots in each row (does not apply to auxiliary axes) SubplotFlags_LinkCols // link the x-axis limits of all plots in each column (does not apply to auxiliary axes) SubplotFlags_LinkAllX // link the x-axis limits in every plot in the subplot (does not apply to auxiliary axes) SubplotFlags_LinkAllY // link the y-axis limits in every plot in the subplot (does not apply to auxiliary axes) SubplotFlags_ColMajor // subplots are added in column major order instead of the default row major order SubplotFlags_None = 0 // default )
Flags for subplots / BeginSubplot