Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .ci/check-formatting.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e

test -z "$(goimports -d .)"
if [[ -n "$(gofmt -s -l .)" ]]; then
echo -e '\e[31mCode not gofmt simplified in:\n\n'
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: Build
strategy:
matrix:
go-version: [1.18.x, 1.17.x]
go-version: [1.19.x, 1.18.x]
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
env:
Expand All @@ -24,18 +24,18 @@ jobs:

steps:
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: ${{ env.GOPATH }}/src/gonum.org/v1/plot
fetch-depth: 1

- name: Cache-Go
uses: actions/cache@v2
uses: actions/cache@v3
with:
# In order:
# * Module download cache
Expand Down Expand Up @@ -79,7 +79,6 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
go test -v ./...
test -z "$(gofmt -d .)"
./.ci/check-imports.sh
./.ci/test-coverage.sh

Expand All @@ -95,4 +94,4 @@ jobs:

- name: Upload-Coverage
if: matrix.platform == 'ubuntu-latest'
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v2
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ build: off

image: Visual Studio 2019

stack: go 1.17
stack: go 1.18

clone_folder: c:\gopath\src\gonum.org\v1\plot

Expand Down
6 changes: 3 additions & 3 deletions cmpimg/cmpimg.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ func cmpImg(v1, v2 image.Image, delta float64) bool {
// yiqEqApprox compares the colors of 2 pixels, in the NTSC YIQ color space,
// as described in:
//
// Measuring perceived color difference using YIQ NTSC
// transmission color space in mobile applications.
// Yuriy Kotsarenko, Fernando Ramos.
// Measuring perceived color difference using YIQ NTSC
// transmission color space in mobile applications.
// Yuriy Kotsarenko, Fernando Ramos.
//
// An electronic version is available at:
//
Expand Down
9 changes: 5 additions & 4 deletions font/len.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ func Points(pt float64) Length {
// e.g. "42cm" "2.4in" "66pt"
// If no unit was given, ParseLength assumes it was (postscript) points.
// Currently valid units are:
// mm (millimeter)
// cm (centimeter)
// in (inch)
// pt (point)
//
// - mm (millimeter)
// - cm (centimeter)
// - in (inch)
// - pt (point)
func ParseLength(value string) (Length, error) {
var unit Length = 1
switch {
Expand Down
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module gonum.org/v1/plot

go 1.17
go 1.18

require (
gioui.org v0.0.0-20210308172011-57750fc8a0a6
Expand All @@ -10,14 +10,15 @@ require (
github.com/go-fonts/liberation v0.2.0
github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81
github.com/go-pdf/fpdf v0.6.0
golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3
golang.org/x/image v0.0.0-20220302094943-723b81ca9867
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
golang.org/x/image v0.0.0-20220722155232-062f8c9fd539
gonum.org/v1/gonum v0.11.0
rsc.io/pdf v0.1.1
)

require (
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
golang.org/x/sys v0.0.0-20210304124612-50617c2ba197 // indirect
golang.org/x/exp/shiny v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect
golang.org/x/text v0.3.7 // indirect
)
12 changes: 8 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3 h1:n9HxLrNxWWtEb1cA950nuEEj3QnKbtsCJ6KjcgisNUs=
golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3/go.mod h1:NOZ3BPKG0ec/BKJQgnvsSFpcKLM5xXVWnvZS97DWHgE=
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA=
golang.org/x/exp/shiny v0.0.0-20220722155223-a9213eeb770e h1:pkl1Ko5DrhA4ezwKwdnmO7H1sKmMy9qLuYKRjS7SlmE=
golang.org/x/exp/shiny v0.0.0-20220722155223-a9213eeb770e/go.mod h1:VjAR7z0ngyATZTELrBSkxOOHhhlnVUxDye4mcjx5h/8=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
Expand All @@ -57,8 +60,8 @@ golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+o
golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.0.0-20220302094943-723b81ca9867 h1:TcHcE0vrmgzNH1v3ppjcMGbhG5+9fMuvOmUYwNEF4q4=
golang.org/x/image v0.0.0-20220302094943-723b81ca9867/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.0.0-20220722155232-062f8c9fd539 h1:/eM0PCrQI2xd471rI+snWuu251/+/jpBpZqir2mPdnU=
golang.org/x/image v0.0.0-20220722155232-062f8c9fd539/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
Expand All @@ -72,8 +75,9 @@ golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210304124612-50617c2ba197 h1:7+SpRyhoo46QjKkYInQXpcfxx3TYFEYkn131lwGE9/0=
golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand Down
1 change: 0 additions & 1 deletion palette/brewer/brewer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
//
// For more information see:
// http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer_learnMore.html
//
package brewer // import "gonum.org/v1/plot/palette/brewer"

import (
Expand Down
16 changes: 14 additions & 2 deletions plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,13 @@ func (p *Plot) NominalY(names ...string) {
//
// Supported formats are:
//
// eps, jpg|jpeg, pdf, png, svg, tex and tif|tiff.
// - .eps
// - .jpg|.jpeg
// - .pdf
// - .png
// - .svg
// - .tex
// - .tif|.tiff
func (p *Plot) WriterTo(w, h vg.Length, format string) (io.WriterTo, error) {
c, err := draw.NewFormattedCanvas(w, h, format)
if err != nil {
Expand All @@ -509,7 +515,13 @@ func (p *Plot) WriterTo(w, h vg.Length, format string) (io.WriterTo, error) {
//
// Supported extensions are:
//
// .eps, .jpg, .jpeg, .pdf, .png, .svg, .tex, .tif and .tiff.
// - .eps
// - .jpg|.jpeg
// - .pdf
// - .png
// - .svg
// - .tex
// - .tif|.tiff
func (p *Plot) Save(w, h vg.Length, file string) (err error) {
f, err := os.Create(file)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion plotter/boxplot.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ type BoxPlot struct {
// NewBoxPlot returns a new BoxPlot that represents
// the distribution of the given values. The style of
// the box plot is that used for Tukey's schematic
// plots is ``Exploratory Data Analysis.''
// plots in “Exploratory Data Analysis.
//
// An error is returned if the boxplot is created with
// no values.
Expand Down
2 changes: 1 addition & 1 deletion plotter/heat.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (h *HeatMap) plotRasterized(c draw.Canvas, plt *plot.Plot) {
pImg.Plot(c, plt)
}

// plotVectorized plots the heatmap using vector-based drawing.
// plotVectorized plots the heatmap using vector-based drawing.
func (h *HeatMap) plotVectorized(c draw.Canvas, plt *plot.Plot) {
if h.Min > h.Max {
panic("contour: invalid Z range: min greater than max")
Expand Down
1 change: 0 additions & 1 deletion plotter/johnson.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ func min(a, b int) int {
// algorithm. The implementation is from the pseudocode at
//
// http://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm?oldid=642744644
//
type tarjan struct {
g graph

Expand Down
6 changes: 3 additions & 3 deletions text/latex.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ func (hdlr Latex) Lines(txt string) []string {
}

// Box returns the bounding box of the given non-multiline text where:
// - width is the horizontal space from the origin.
// - height is the vertical space above the baseline.
// - depth is the vertical space below the baseline, a positive number.
// - width is the horizontal space from the origin.
// - height is the vertical space above the baseline.
// - depth is the vertical space below the baseline, a positive number.
func (hdlr Latex) Box(txt string, fnt font.Font) (width, height, depth vg.Length) {
cnv := drawtex.New()
face := hdlr.Fonts.Lookup(fnt, fnt.Size)
Expand Down
6 changes: 3 additions & 3 deletions text/plain.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ func (hdlr Plain) Lines(txt string) []string {
}

// Box returns the bounding box of the given non-multiline text where:
// - width is the horizontal space from the origin.
// - height is the vertical space above the baseline.
// - depth is the vertical space below the baseline, a positive number.
// - width is the horizontal space from the origin.
// - height is the vertical space above the baseline.
// - depth is the vertical space below the baseline, a positive number.
func (hdlr Plain) Box(txt string, fnt font.Font) (width, height, depth vg.Length) {
face := hdlr.Fonts.Lookup(fnt, fnt.Size)
ext := face.Extents()
Expand Down
4 changes: 3 additions & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ const root = "gonum.org/v1/plot"
//
// If a replace directive exists in the Gonum/plot go.mod, the replace will
// be reported in the version in the following format:
// "version=>[replace-path] [replace-version]"
//
// "version=>[replace-path] [replace-version]"
//
// and the replace sum will be returned in place of the original sum.
//
// The exact version format returned by Version may change in future.
Expand Down
10 changes: 5 additions & 5 deletions vg/draw/canvas.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,11 @@ func New(c vg.CanvasSizer) Canvas {
// image format. Supported formats need to be registered by importing one or
// more of the following packages:
//
// gonum.org/v1/plot/vg/vgeps // provides eps
// gonum.org/v1/plot/vg/vgimg // provides png, jpg|jpeg, tif|tiff
// gonum.org/v1/plot/vg/vgpdf // provides pdf
// gonum.org/v1/plot/vg/vgsvg // provides svg
// gonum.org/v1/plot/vg/vgtex // provides tex
// - gonum.org/v1/plot/vg/vgeps: provides eps
// - gonum.org/v1/plot/vg/vgimg: provides png, jpg|jpeg, tif|tiff
// - gonum.org/v1/plot/vg/vgpdf: provides pdf
// - gonum.org/v1/plot/vg/vgsvg: provides svg
// - gonum.org/v1/plot/vg/vgtex: provides tex
func NewFormattedCanvas(w, h vg.Length, format string) (vg.CanvasWriterTo, error) {
formats.RLock()
defer formats.RUnlock()
Expand Down
9 changes: 5 additions & 4 deletions vg/len.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ const (
// e.g. "42cm" "2.4in" "66pt"
// If no unit was given, ParseLength assumes it was (postscript) points.
// Currently valid units are:
// mm (millimeter)
// cm (centimeter)
// in (inch)
// pt (point)
//
// - mm (millimeter)
// - cm (centimeter)
// - in (inch)
// - pt (point)
func ParseLength(value string) (Length, error) {
return font.ParseLength(value)
}
4 changes: 2 additions & 2 deletions vg/vggio/vggio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const deltaGio = 0.05 // empirical value from experimentation.
// On GitHub Actions and on linux, that headless display may take some time to
// be properly available and appears to be setup "on demand".
// So we request it by trying to take a screenshot twice:
// - the first time around might fail
// - the second time shouldn't.
// - the first time around might fail
// - the second time shouldn't.
func init() {
if runtime.GOOS != "linux" {
return
Expand Down
2 changes: 1 addition & 1 deletion vg/vgpdf/vgpdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
// font files, needed by gofpdf to embed fonts in a PDF document.
// We use cp1252 (code page 1252, Windows Western) to encode characters.
// See:
// - https://en.wikipedia.org/wiki/Windows-1252
// - https://en.wikipedia.org/wiki/Windows-1252
//
// TODO: provide a Canvas-level func option to embed fonts with a user provided
// code page schema?
Expand Down
2 changes: 1 addition & 1 deletion vg/vgsvg/vgsvg.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// this issue.
//
// Alternatively, users may want to install the Liberation fonts on their system:
// - https://en.wikipedia.org/wiki/Liberation_fonts
// - https://en.wikipedia.org/wiki/Liberation_fonts
package vgsvg // import "gonum.org/v1/plot/vg/vgsvg"

import (
Expand Down