Default tick marks should be more "balanced"
- Dominant language
- Go
- Stars
- 3k
- Forks
- 201
- PR merge metrics
- No merged PRs in 30d
Description
Original [issue 114](https://code.google.com/p/plotinum/issues/detail?id=114) created by eaburns on 2013-02-20T19:08:16.000Z:
In the plot below, the tick marks are "top heavy" (or "right heavy" if you consider the X axis). If the major and minor ticks were swapped then the major tick marks would look more balanced. It may be easy to get more balanced ticks by looking at the mean value of the major ticks and comparing it to the center of the axis. The closer the mean is to the center, the more balanced the ticks are.
``` go
package main
import (
"code.google.com/p/plotinum/plot"
"code.google.com/p/plotinum/plotter"
"code.google.com/p/plotinum/plotutil"
)
var (
newSched = speedup{
{ 1, 23.857 },
{ 2, 12.183 },
{ 4, 6.557 },
{ 8, 4.338 },
{ 16, 3.478 },
{ 32, 2.385 },
}
oldSched = speedup{
{ 1, 23.163},
{ 2, 22.182},
{ 4, 25.568 },
{ 8, 31.372},
{ 16, 27.275 },
{ 32,26.074 },
}
)
func main() {
p, err := plot.New()
if err != nil {
panic(err)
}
plotutil.AddLinePoints(p, "new", newSched, "old", oldSched)
p.Add(plotter.NewFunction(func(x float64)float64{ return x }))
p.Title.Text = "Speedup of schedulers"
p.X.Label.Text = "proc"
p.Y.Label.Text = "speedup (of real time)"
p.Legend.Top = true
p.Legend.Left = true
p.Y.Max = 32
p.Save(4, 4, "speedup.svg")
}
type speedup plotter.XYs
func (s speedup) Len() int {
return plotter.XYs(s).Len()
}
func (s speedup) XY(i int) (float64, float64) {
x, y := plotter.XYs(s).XY(i)
_, y0 := plotter.XYs(s).XY(0)
return x, y0/y
}
```
Contributor guide
Assessment
This issue has not been assessed yet.