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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ while no release is tagged:

`https://go-plot.github.io/docs/` redirects to `latest/`. Each push to `main`
replaces the directory of the version it describes, and nothing else. The
pages describe **v0.2.0**, published under `0.2/`.
pages describe **v0.3.0**, published under `0.3/`.

To document a new release, set `params.plot.version` to its tag, require the
same version in `figures/go.mod`, redraw the figures, and update the pages.
Expand Down Expand Up @@ -68,10 +68,10 @@ cd figures && go run .
git clone --recurse-submodules https://github.com/go-plot/docs.git
cd docs
mkdir -p data && sh themes/hextra/scripts/page-history.sh > data/pagehistory.json
hugo server --baseURL http://localhost:1313/docs/0.2/
hugo server --baseURL http://localhost:1313/docs/0.3/
```

then open <http://localhost:1313/docs/0.2/>. Hugo 0.146 or later; no Python,
then open <http://localhost:1313/docs/0.3/>. Hugo 0.146 or later; no Python,
no Node. Go 1.27.2 or later only to redraw the figures.

## Publication
Expand Down
12 changes: 7 additions & 5 deletions content/en/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ set by a real TeX math typesetter, [go-tex/math](https://github.com/go-tex/math)
<img class="figure" src="images/figures/quickstart.svg" alt="A sine curve drawn as a line and as markers, with a TeX label and a legend">

These pages describe [go-plot/plot](https://github.com/go-plot/plot)
**v0.2.0**. Every figure in them was drawn by that version, from the code shown
beside it. New in v0.2.0:
**v0.3.0**. Every figure in them was drawn by that version, from the code shown
beside it.

- [pie and donut charts]({{< relref "plot-types#pie-and-donut" >}}).
- An SVG that can be inlined under a strict Content-Security-Policy.
- New in v0.3.0: [text from data, without TeX]({{< relref "tex#text-from-data-no-tex" >}}).
- New in v0.2.0:
- [pie and donut charts]({{< relref "plot-types#pie-and-donut" >}});
- an SVG that can be inlined under a strict Content-Security-Policy.

## Install

```sh
go get github.com/go-plot/plot@v0.2.0
go get github.com/go-plot/plot@v0.3.0
```

The module needs Go 1.27.2 or later. It is pure Go (`CGO_ENABLED=0`) and builds
Expand Down
2 changes: 1 addition & 1 deletion content/en/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tags: [start]
## Install

```sh
go get github.com/go-plot/plot@v0.2.0
go get github.com/go-plot/plot@v0.3.0
```

Go 1.27.2 or later. Nothing else: no Python, no C library, no font to install.
Expand Down
2 changes: 1 addition & 1 deletion content/en/plot-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: "Every plot type of v0, each with the code that drew it."
tags: [api, gallery]
---

Each figure on this page was drawn by go-plot v0.2.0 from the code below it.
Each figure on this page was drawn by go-plot v0.3.0 from the code below it.
The code is not a copy: the page reads it from
[`figures/`](https://github.com/go-plot/docs/tree/main/figures) in this
site's repository, where `go run .` draws every image, and the CI draws them
Expand Down
19 changes: 19 additions & 0 deletions content/en/tex.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,25 @@ OS/2 table, alignment, rotation, anchoring), and like Agg the pen is put on a
whole pixel. How the pixels of text differ from matplotlib's is on
[Differences]({{< relref "differences#text" >}}).

## Text from data: no TeX

A string is read as matplotlib reads it: TeX between an even number of
unescaped dollar signs. Names that come from data ("100$", a team called
`$x$`) should not be. go-plot follows matplotlib's `parse_math`:

| go-plot | matplotlib |
| --- | --- |
| `plot.NewFigure(plot.ParseMath(false))`, `fig.SetParseMath(false)` | `rcParams["text.parse_math"] = False` |
| `plot.PlainText()` on one call | `parse_math=False` on that text |
| `plot.MathText()` on one call | `parse_math=True` on that text |

The calls that take it are `SetTitle`, `SetXLabel` and `SetYLabel`. So do
`SetXTickLabels` and `SetYTickLabels` (category names under bars), `Legend`
(every entry), `Text`, `Annotate` and `Pie`. A plain string is drawn
character for character as glyph outlines. It never reaches the TeX
typesetter, and `<script>` becomes shapes, not markup. The tick labels
go-plot's formatters write (`10³` on a log axis) stay math.

## Cost

STIX Two Math is parsed only when a label contains TeX: a figure without any
Expand Down
2 changes: 1 addition & 1 deletion figures/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.27.2

require (
github.com/go-ndarray/ndarray v0.18.0
github.com/go-plot/plot v0.2.0
github.com/go-plot/plot v0.3.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions figures/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ github.com/go-opentype/fonts v0.14.0 h1:WHw7k9gkHT1pu9B2yyvd0FWyQqn/4NKFQoKhvMYt
github.com/go-opentype/fonts v0.14.0/go.mod h1:od2QcmdpKo7QCqo6Jb16y4GULk+h2Hhfq6x3xfvn62Q=
github.com/go-opentype/opentype v0.16.0 h1:8FnPhPXQ0E3dVqfGlf8wh/v9g0eIFc7tlzUH4yi2Lu4=
github.com/go-opentype/opentype v0.16.0/go.mod h1:ZB31jTJl2mhPESXYMuUW+p36UrOabw/2+6mtyh/vNnI=
github.com/go-plot/plot v0.2.0 h1:EOIL3Nvrp2kos6uhoECTMA8tQSSQv50xGVuMqVVoJG4=
github.com/go-plot/plot v0.2.0/go.mod h1:+uBqMFBVLL8kAeJ7hcPfThYKV1n26Crqi3eSruc1+qg=
github.com/go-plot/plot v0.3.0 h1:++Op5Z3HngvLNRl/ASU9AXlSwRoEzC0idHbudFUyBIo=
github.com/go-plot/plot v0.3.0/go.mod h1:+uBqMFBVLL8kAeJ7hcPfThYKV1n26Crqi3eSruc1+qg=
github.com/go-tex/math v0.50.0 h1:YHJ3LYzS45zBoPKGBkZW4+LUQkOeHP30YWLsfXGZCpo=
github.com/go-tex/math v0.50.0/go.mod h1:cPm5juijQkhFj1MCByLF8tOfZ+UswAGUPBh+Wy6+vbw=
github.com/go-widgets/painter v0.16.0 h1:j8FFObisySQChY2JiXS7Di2Mo4cqufIc0PDUnoDPMiA=
Expand Down
4 changes: 2 additions & 2 deletions hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# version of go-plot/plot the pages describe (0.1, 0.2, ...), or "main" while no
# release is tagged. The CI sets it through --baseURL, from
# params.plot.version below. This default is the same build.
baseURL: "https://go-plot.github.io/docs/0.2/"
baseURL: "https://go-plot.github.io/docs/0.3/"
title: "go-plot"
# themes/hextra is the tannevaled/hextra fork, pinned at a release tag:
# upstream Hextra plus opt-in features (partial menu items, combos,
Expand Down Expand Up @@ -90,7 +90,7 @@ params:
# documentation's version label (v0.1.2 -> 0.1): the CI reads it here.
# The figures/ module requires the same version: the CI checks they agree.
plot:
version: "v0.2.0"
version: "v0.3.0"
versions:
# The version selector shows "main" with the development icon.
development: "main"
Expand Down
Loading