-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plotter: fix handling of x/y-offsets in Labels glyph boxes #711
Conversation
Codecov Report
@@ Coverage Diff @@
## master #711 +/- ##
==========================================
- Coverage 71.91% 71.84% -0.08%
==========================================
Files 56 58 +2
Lines 4957 5171 +214
==========================================
+ Hits 3565 3715 +150
- Misses 1206 1261 +55
- Partials 186 195 +9
Continue to review full report at Codecov.
|
note that we're still not out of the woods: the |
plotter/labels_test.go
Outdated
// label with positive x/y-offsets | ||
loffp, err := plotter.NewLabels(plotter.XYLabels{ | ||
XYs: []plotter.XY{ | ||
{X: +0.0 + left, Y: +0}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the unary +
s and decimal points necessary?
PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One unresolved nit in labels_test.go.
func (l *Labels) GlyphBoxes(p *plot.Plot) []plot.GlyphBox { | ||
bs := make([]plot.GlyphBox, len(l.Labels)) | ||
for i, label := range l.Labels { | ||
bs[i].X = p.X.Norm(l.XYs[i].X) | ||
bs[i].Y = p.Y.Norm(l.XYs[i].Y) | ||
sty := l.TextStyle[i] | ||
bs[i].Rectangle = sty.Rectangle(label) | ||
bs[i] = plot.GlyphBox{ | ||
X: p.X.Norm(l.XYs[i].X), | ||
Y: p.Y.Norm(l.XYs[i].Y), | ||
Rectangle: l.TextStyle[i].Rectangle(label).Add(l.Offset), | ||
} | ||
} | ||
return bs | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really nice now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you made it happen :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Team work; I wouldn't have looked without prompting.
This CL fixes the handling of the X/Y-offsets of plotter.Labels: they were previously ignored in the glyph box computation. This CL also adds a test that exercizes offsetted labels and their glyph box. Fixes gonum#710.
sorry, fixed PTAL. |
This CL fixes the handling of the X/Y-offsets of plotter.Labels: they
were previously ignored in the glyph box computation.
This CL also adds a test that exercizes offsetted labels and their glyph box.
Fixes #710.
Please take a look.