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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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