plotcore

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2025 License: BSD-3-Clause Imports: 33 Imported by: 1

Documentation

Overview

Package plotcore provides Cogent Core widgets for viewing and editing plots.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Editor

type Editor struct {
	core.Frame

	// PlotStyle has the overall plot style parameters.
	PlotStyle plot.PlotStyle
	// contains filtered or unexported fields
}

Editor is a widget that provides an interactive 2D plot of selected columns of tabular data, represented by a table.Table into a table.Table. Other types of tabular data can be converted into this format. The user can change various options for the plot and also modify the underlying data.

func NewEditor

func NewEditor(parent ...tree.Node) *Editor

NewEditor returns a new Editor with the given optional parent: Editor is a widget that provides an interactive 2D plot of selected columns of tabular data, represented by a table.Table into a table.Table. Other types of tabular data can be converted into this format. The user can change various options for the plot and also modify the underlying data.

func NewSubPlot

func NewSubPlot(parent ...tree.Node) *Editor

NewSubPlot returns a Editor with its own separate core.Toolbar, suitable for a tab or other element that is not the main plot.

func (*Editor) CopyFieldsFrom

func (pl *Editor) CopyFieldsFrom(frm tree.Node)

func (*Editor) GoUpdatePlot

func (pl *Editor) GoUpdatePlot()

GoUpdatePlot updates the display based on current Indexed view into table. This version can be called from goroutines. It does Sequential() on the table.Table, under the assumption that it is used for tracking a the latest updates of a running process.

func (*Editor) Init

func (pl *Editor) Init()

func (*Editor) MakeToolbar

func (pl *Editor) MakeToolbar(p *tree.Plan)

func (*Editor) OpenCSV

func (pl *Editor) OpenCSV(filename core.Filename, delim tensor.Delims)

OpenCSV opens the Table data from a csv (comma-separated values) file (or any delim)

func (*Editor) OpenFS

func (pl *Editor) OpenFS(fsys fs.FS, filename core.Filename, delim tensor.Delims)

OpenFS opens the Table data from a csv (comma-separated values) file (or any delim) from the given filesystem.

func (*Editor) SaveAll

func (pl *Editor) SaveAll(fname core.Filename)

SaveAll saves the current plot to a png, svg, and the data to a tsv -- full save Any extension is removed and appropriate extensions are added

func (*Editor) SaveCSV

func (pl *Editor) SaveCSV(fname core.Filename, delim tensor.Delims)

SaveCSV saves the Table data to a csv (comma-separated values) file with headers (any delim)

func (*Editor) SavePNG

func (pl *Editor) SavePNG(fname core.Filename)

SavePNG saves the current plot to a png, capturing current render

func (*Editor) SaveSVG

func (pl *Editor) SaveSVG(fname core.Filename)

SaveSVG saves the plot to an svg -- first updates to ensure that plot is current

func (*Editor) SetPlotStyle

func (t *Editor) SetPlotStyle(v plot.PlotStyle) *Editor

SetPlotStyle sets the [Editor.PlotStyle]: PlotStyle has the overall plot style parameters.

func (*Editor) SetSlice

func (pl *Editor) SetSlice(sl any, stylers ...func(s *plot.Style)) *Editor

SetSlice sets the table to a table.NewSliceTable from the given slice. Optional styler functions are used for each struct field in sequence, and any can contain global plot style.

func (*Editor) SetTable

func (pl *Editor) SetTable(tab *table.Table) *Editor

SetTable sets the table to a new view of given table, and does UpdatePlot.

func (*Editor) SizeFinal

func (pt *Editor) SizeFinal()

func (*Editor) UpdatePlot

func (pl *Editor) UpdatePlot()

UpdatePlot updates the display based on current Indexed view into table. It does not automatically update the table.Table unless it is nil or out date.

type Plot

type Plot struct {
	core.WidgetBase

	// Plot is the Plot to display in this widget
	Plot *plot.Plot `set:"-"`

	// SetRangesFunc, if set, is called to adjust the data ranges
	// after the point when these ranges are updated based on the plot data.
	SetRangesFunc func()
}

Plot is a widget that renders a plot.Plot object. If it is not states.ReadOnly, the user can pan and zoom the graph. See Editor for an interactive interface for selecting columns to view.

func NewPlot

func NewPlot(parent ...tree.Node) *Plot

NewPlot returns a new Plot with the given optional parent: Plot is a widget that renders a plot.Plot object. If it is not states.ReadOnly, the user can pan and zoom the graph. See Editor for an interactive interface for selecting columns to view.

func (*Plot) Init

func (pt *Plot) Init()

func (*Plot) Render

func (pt *Plot) Render()

func (*Plot) SetPlot

func (pt *Plot) SetPlot(pl *plot.Plot) *Plot

SetPlot sets the plot to the given plot.Plot. You must still call core.WidgetBase.Update to trigger a redrawing of the plot.

func (*Plot) SetSetRangesFunc

func (t *Plot) SetSetRangesFunc(v func()) *Plot

SetSetRangesFunc sets the [Plot.SetRangesFunc]: SetRangesFunc, if set, is called to adjust the data ranges after the point when these ranges are updated based on the plot data.

func (*Plot) SizeFinal

func (pt *Plot) SizeFinal()

func (*Plot) WidgetTooltip

func (pt *Plot) WidgetTooltip(pos image.Point) (string, image.Point)

type PlotterChooser

type PlotterChooser struct {
	core.Chooser
}

PlotterChooser represents a [Plottername] value with a core.Chooser for selecting a plotter.

func NewPlotterChooser

func NewPlotterChooser(parent ...tree.Node) *PlotterChooser

NewPlotterChooser returns a new PlotterChooser with the given optional parent: PlotterChooser represents a [Plottername] value with a core.Chooser for selecting a plotter.

func (*PlotterChooser) Init

func (fc *PlotterChooser) Init()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL