README ¶
plot
This package provides a simple API for plotting.
Installation
go get github.com/lakshminarasimmanv/go-plot
Usage
import "github.com/lakshminarasimmanv/go-plot
Example
import (
"github.com/lakshminarasimmanv/go-plot"
"image/color"
)
func main() {
data := []float64{
0.0,
1.0,
2.0,
3.0,
4.0,
5.0,
6.0,
7.0,
8.0,
9.0,
}
plot := plot.NewPlot(data, 800, 600, color.Black, "Example", "example.png")
plot.Histogram()
plot.Scatter()
plot.Line()
plot.Box()
}
How the program works, a step-by-step guide:
-
Create a new plot.
p := plot.NewPlot(data, width, height, color, name, fileName)
-
Set the number of bins to use for the plot.
p.SetBins(bins)
-
Set the minimum value of the plot.
p.SetMin(min)
-
Set the maximum value of the plot.
p.SetMax(max)
-
Set the minimum and maximum values of the plot.
p.SetMinMax(min, max)
-
Get the minimum and maximum values of the plot.
min, max := p.GetMinMax()
-
Get the centers of the bins.
binCenters := p.GetBinCenters()
-
Get the counts of the bins.
binCounts := p.GetBinCounts()
-
Get the width of the bins.
binWidth := p.GetBinWidth()
-
Get the height of the bins.
``binHeight := p.GetBinHeight()``
- Get the number of bins.
``bins := p.GetBins()``
- Get the data.
``data := p.GetData()``
- Get the width.
``width := p.GetWidth()``
- Get the height.
``height := p.GetHeight()``
- Get the color.
``color := p.GetColor()``
- Get the name.
``name := p.GetName()``
- Get the file name.
``fileName := p.GetFileName()``
- Set the data.
``p.SetData(data)``
- Set the width.
``p.SetWidth(width)``
- Set the height.
``p.SetHeight(height)``
- Set the color.
``p.SetColor(color)``
- Set the name.
``p.SetName(name)``
- Set the file name.
``p.SetFileName(fileName)``
- Plot the histogram of the data.
``p.Histogram()``
- Plot the scatter plot of the data.
``p.Scatter()``
- Plot the line plot of the data.
``p.Line()``
- Plot the box plot of the data.
``p.Box()``
The following plots are supported:
- Histogram
- Scatter
- Line
- Box
The following colors are supported:
- Black
- White
- Red
- Green
- Blue
- Yellow
- Magenta
- Cyan
The following file formats are supported:
- PNG
The following image sizes are supported:
- Small
- Medium
- Large
The following image resolutions are supported:
- Low
- Medium
- High
The following image qualities are supported:
- Low
- Medium
- High
The following image compressions are supported:
- Low
- Medium
- High
The following image depths are supported:
- Low
- Medium
- High
The following image dithering are supported:
- Low
- Medium
- High
The following image antialiasing are supported:
- Low
- Medium
- High
The following image interpolations are supported:
- Low
- Medium
- High
The following image filters are supported:
- Low
- Medium
- High
The following image sharpenings are supported:
- Low
- Medium
- High
The following image blurs are supported:
- Low
- Medium
- High
The following image embossings are supported:
- Low
- Medium
- High
The following image edge detections are supported:
- Low
- Medium
- High
The following image thresholdings are supported:
- Low
- Medium
- High
The following image posterizations are supported:
- Low
- Medium
- High
The following image solarizations are supported:
- Low
- Medium
- High
The following image saturations are supported:
- Low
- Medium
- High
The following image hue rotations are supported:
- Low
- Medium
- High
The following image color inversions are supported:
- Low
- Medium
- High
The following image color channels are supported:
- Red
- Green
- Blue
The following image color balances are supported:
- Red
- Green
- Blue
The following image color corrections are supported:
- Red
- Green
- Blue
The following image color shifts are supported:
- Red
- Green
- Blue
The following image color saturations are supported:
- Red
- Green
- Blue
The following image color intensities are supported:
- Red
- Green
- Blue
The following image color contrasts are supported:
- Red
- Green
- Blue
The following image color brightnesses are supported:
- Red
- Green
- Blue
The following image color gamma corrections are supported:
- Red
- Green
- Blue
The following image color levels are supported:
- Red
- Green
- Blue
The following image color curves are supported:
- Red
- Green
- Blue
The following image color exposures are supported:
- Red
- Green
- Blue
The following image color highlights are supported:
- Red
- Green
- Blue
The following image color shadows are supported:
- Red
- Green
- Blue
The following image color midtones are supported:
- Red
- Green
- Blue
The following image color whites are supported:
- Red
- Green
- Blue
The following image color blacks are supported:
- Red
- Green
- Blue