MCPcopy Create free account
hub / github.com/cogentcore/core / SetPlot

Method SetPlot

plot/plotcore/plot.go:41–47  ·  view source on GitHub ↗

SetPlot sets the plot to given Plot, and calls UpdatePlot to ensure it is drawn at the current size of this widget

(pl *plot.Plot)

Source from the content-addressed store, hash-verified

39// SetPlot sets the plot to given Plot, and calls UpdatePlot to ensure it is
40// drawn at the current size of this widget
41func (pt *Plot) SetPlot(pl *plot.Plot) {
42 if pl != nil && pt.Plot != nil && pt.Plot.Pixels != nil {
43 pl.SetPixels(pt.Plot.Pixels) // re-use the image!
44 }
45 pt.Plot = pl
46 pt.updatePlot()
47}
48
49// updatePlot draws the current plot at the size of the current widget,
50// and triggers a Render so the widget will be rendered.

Callers 1

genPlotMethod · 0.80

Calls 2

updatePlotMethod · 0.95
SetPixelsMethod · 0.45

Tested by

no test coverage detected