@@ -305,16 +305,14 @@ func (a horizontalAxis) GlyphBoxes(p *Plot) []GlyphBox {
305305 x := a .Norm (p .X .Max )
306306 switch a .Label .Position {
307307 case draw .PosCenter :
308- x = a .Norm (0.5 * (p .X .Max - p . X . Min ) + p .X .Min )
308+ x = a .Norm (0.5 * (p .X .Max + p .X .Min ) )
309309 case draw .PosRight :
310310 x -= a .Norm (0.5 * a .Label .TextStyle .Width (a .Label .Text ).Points ()) // FIXME(sbinet): want data coordinates
311311 }
312312 descent := a .Label .TextStyle .FontExtents ().Descent
313313 boxes = append (boxes , GlyphBox {
314- X : x ,
315- Rectangle : a .Label .TextStyle .Rectangle (a .Label .Text ).Add (vg.Point {
316- Y : yoff + descent ,
317- }),
314+ X : x ,
315+ Rectangle : a .Label .TextStyle .Rectangle (a .Label .Text ).Add (vg.Point {Y : yoff + descent }),
318316 })
319317 yoff += a .Label .TextStyle .Height (a .Label .Text )
320318 yoff += a .Label .Padding
@@ -434,7 +432,7 @@ func (a verticalAxis) GlyphBoxes(p *Plot) []GlyphBox {
434432 yoff := a .Norm (p .Y .Max )
435433 switch a .Label .Position {
436434 case draw .PosCenter :
437- yoff = a .Norm (0.5 * (p .Y .Max - p . Y . Min ) + p .Y .Min )
435+ yoff = a .Norm (0.5 * (p .Y .Max + p .Y .Min ) )
438436 case draw .PosTop :
439437 yoff -= a .Norm (0.5 * a .Label .TextStyle .Width (a .Label .Text ).Points ()) // FIXME(sbinet): want data coordinates
440438 }
@@ -443,19 +441,17 @@ func (a verticalAxis) GlyphBoxes(p *Plot) []GlyphBox {
443441 sty .Rotation += math .Pi / 2
444442
445443 xoff += a .Label .TextStyle .Height (a .Label .Text )
446- desc := a .Label .TextStyle .FontExtents ().Descent
444+ descent := a .Label .TextStyle .FontExtents ().Descent
447445 boxes = append (boxes , GlyphBox {
448- Y : yoff ,
449- Rectangle : sty .Rectangle (a .Label .Text ).Add (vg.Point {
450- X : xoff - desc ,
451- }),
446+ Y : yoff ,
447+ Rectangle : sty .Rectangle (a .Label .Text ).Add (vg.Point {X : xoff - descent }),
452448 })
453- xoff += desc
449+ xoff += descent
454450 xoff += a .Label .Padding
455451 }
456452
457453 marks := a .Tick .Marker .Ticks (a .Min , a .Max )
458- if w := tickLabelWidth (a .Tick .Label , marks ); len (marks ) > 0 && w > 0 {
454+ if w := tickLabelWidth (a .Tick .Label , marks ); len (marks ) != 0 && w > 0 {
459455 xoff += w
460456 }
461457
0 commit comments