package
0.2.0
Repository: https://github.com/sugarme/lab.git
Documentation: pkg.go.dev

# README

Plot

Plot package provides ways to plot data to various type of graphics (image, text, svg).

Below are some examples of charts.

Basic Charts

Scatter Chart

Scatter chart

Bar Chart

bar chart

category bar chart

category bar chart

Pie Chart

Pie chart

Pie chart

Histogram

Histogram

Strip Chart

Strip chart

Mieten Chart

Mieten chart

Graphic Text

Graphic text

Graphic text

Chart Components

Autoscale

autoscale

Axis

log axis

Function

function plot

Tic

Scatter tics

Kernel

Kernels

Real Use Cases

Train valid Loss

Train valid loss

Find learning rate

Find learning rate

Acknowledgement

Most of the code here are taken and modified from

  1. https://github.com/vdobler/chart
  2. https://github.com/ajstarks/svgo

# Packages

No description provided by the author

# Functions

AbsoluteValue will format value (ignoring sum).
AddTo returns a new ImageGraphics which will write to (width x height) sized area starting at (x,y) on the provided image img.
AddTo returns a new ImageGraphics which will write to (width x height) sized area starting at (x,y) on the provided SVG.
AutoStyle produces a styles based on StandardColors, StandardLineStyles, and StandardSymbols.
No description provided by the author
No description provided by the author
FmtFloat yields a string representation of f.
No description provided by the author
GenericBars draws the bars in the given style using bg.
GenericBoxes draws box plots.
GenericCircle approximates a circle of radius r around (x,y) with lines.
GenericKey draws the key onto bg at (x,y).
GenericPath is the incomplete implementation of a list of points connected by straight lines.
GenericRect draws a rectangle of size w x h at (x,y).
GeenricRings draws wedges for pie/ring charts charts.
GenericScatter draws the given points according to style.
GenericSymbol draws the symbol defined by style at (x,y).
GenericTextLen tries to determine the width in pixel of t if rendered into mg in using font.
GenericWedge draws a pie/wedge just by lines.
GenericXAxis draws the x-axis with range rng solely by graphic primitives of bg.
GenericYAxis draws the y-axis with the range rng solely by graphic primitives of bg.
IntegerValue will format value (ignoring sum) as an integer.
No description provided by the author
NewImageGraphics creates a new ImageGraphics including an image.RGBA of dimension w x h with background bgcol.
NewImagePlotter creates a new ImagePlotter.
NewPlotter creates new Plotter.
NewSVG is the SVG constructor, specifying the io.Writer where the generated SVG is written.
New creates a new SvgGraphics of dimension w x h, with a default font font of size fontsize.
NewSvgPlotter creates new SvgPlotter.
Set up a new TextBuf with width w and height h.
NewTextGraphics creates a TextGraphic of dimensions w x h.
NewTextPlotter creates new TextPlotter.
NextSymbol returns the next symbol of s: Either in the global list Symbol or (if not found there) the next character.
No description provided by the author
Return p percentil of pre-sorted integer data.
PercentValue formats value as percentage of sum.
RoundDown will round tp down to next "full" d.
RoundNext will round t to nearest full d.
RoundUp will round tp up to next "full" d.
SanitizeRect returns the top left corner and the positive width and height of the given (possibly unsanitized) rectangle taking into account the line width r.
Compute minimum, p percentil, median, average, 100-p percentil and maximum of values in data.
Compute minimum, p percentil, median, average, 100-p percentil and maximum of values in data.
Return real character len of s (rune count).
SymbolIndex returns the index of the symbol s in Symbol or -1 if not found.
WithPlotterLayout adds layout option.
WithPlotterType adds graphic type options.

# Constants

---- - - ---- - -.
---- ---- ---- ----.
- - - - - - - - - - -.
Like ExpandToTic and add/subtract ExpandABitFraction of tic distance.
Set min/max to next tic really below/above min/max of data.
Use data min/max as limit.
Set to next tic below/above or equal to min/max of data.
No description provided by the author
Zebra style background.
No description provided by the author
Grid lines.
No grid lines.
No description provided by the author
No description provided by the author
No description provided by the author
.
The supported line styles.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
draw a full mirrored axis including tics.
just draw a mirrord axis, but omit tics.
do not draw a mirrored axis.
No description provided by the author
produce boxplot.
connect data points by straight lines.
symbols and lines.
draw symbol at data point.
No description provided by the author
No description provided by the author
----------------------.
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

15/16 * (1-x^2)^2.
CharacterWidth is a table of the (relative) width of common runes.
No description provided by the author
DebugLogger is used to log some information about the chart generation.
DefaultStyle maps chart elements to styles.
Delta is a list of increasing time deltas used to construct tic spacings for date/time axis.
Different edge styles for boxes.
3/4 * (1-x^2).
ExpandABitFraction is the fraction of a major tic spacing added during axis range expansion with the ExpandABit mode.
1/sqrt(2pi) * exp(-1/2x^2).
Horizontal spacing between two columns in key.
Horizontal spacing between key box and content.
Vertical spacing between individual rows.
Horizontal spacing bewteen symbol and text.
Horizontal length/space reserved for symbol.
Vertical spacing between key box and content.
How much are flaged segments offset.
Scaling factor of radius of next data set.
1/2.
Standard colors used by AutoStyle.
How much brighter/darker filled elements become.
Standard line styles used by AutoStyle (fill=false).
Standard symbols used by AutoStyle.
Symbol is the list of different symbols.
1 - |x|.
35/32 * (1-x^2)^3.
Units are the SI prefixes for 10^3n.

# Structs

BarChart draws simple bar charts.
BarChartData encapsulates data sets in a bar chart.
Barinfo describes a rectangular bar (e.g.
Box represents a box in an boxplot.
BoxChart represents box charts.
BoxChartData encapsulates a data set in a box chart.
No description provided by the author
CatValue is the standard implementation for CategoryValue.
Day.
EPoint represents a point in two dimensions (X,Y) with possible error ranges in both dimensions.
Filterspec defines the specification of SVG filters.
Font describes a font.
HistChart represents histogram charts.
HistChartData encapsulates one data set in a histogram chart.
Hour.
ImageGraphics writes plot to an image.RGBA.
No description provided by the author
Key encapsulates settings for keys/legends in a chart.
KeyEntry encapsulates an antry in the key/legend.
LayoutData encapsulates the layout of the graph area in the whole drawing area.
Minute.
Month.
Offcolor defines the offset and color for gradients.
PieChart represents pie and ring charts.
No description provided by the author
Point is a point in two dimensions (x,y) implementing XYValue.
Range encapsulates all information about an axis.
RangeMode describes how one end of an axis is set up.
ScatterChart represents scatter charts, line charts and function plots.
ScatterChartData encapsulates a data set or function in a scatter chart.
Second.
StripChart represents very simple strip charts.
Style contains all information about all graphic elements in a chart.
SVG defines the location of the generated SVG.
SvgGraphics implements BasicGraphics and uses the generic implementations.
No description provided by the author
A Text Buffer.
TextGraphics.
No description provided by the author
Tic describs a single tic on an axis.
TicSetting describes how (if at all) tics are shown on an axis.
Wedgeinfo describes a wedge in a pie chart.
Week.
Year.

# Interfaces

BasicGraphics is an interface of the most basic graphic primitives.
CategoryValue is the interface for any type of data which is a category-real-pair.
Chart ist the very simple interface for all charts: They can be plotted to a graphics output.
Graphics is the interface all chart drivers have to implement.
MinimalGraphics is the interface any graphics driver must implement, so that he can fall back to the generic routines for the higher level outputs.
No description provided by the author
Represents a tic-distance in a timed axis.
Value is the interface for any type of data representable by a real.
XYErrValue is the interface for any type of data which is point-like (x,y) and has some measurement error.
XYValue is the interface for any type of data which is point-like and has a x- and y-coordinate.

# Type aliases

Expansion determines the way an axis range is expanded to align nicely with the tics on the axis.
FontSize is the relative font size used in chart.
GridMode describes the way a grid on the major tics is drawn.
Kernel is a smoothing kernel for histograms.
LineStyle describes the different types of lines.
MirrorAxis describes if and how an axis is drawn on the oposite side of a chart,.
PlotElement identifies one element in a plot/chart.
PlotOptions contains a Style for each PlotElement.
PlotStyle describes how data and functions are drawn in scatter plots.
No description provided by the author
Real is a float64 implementing the Value interface.