diff --git a/docs/src/polygons.md b/docs/src/polygons.md index ec08a8c2..7c3352b8 100644 --- a/docs/src/polygons.md +++ b/docs/src/polygons.md @@ -798,18 +798,19 @@ sethue("black") setline(0.25) outerframe = Table([500], [400, 200]) total = 30 -properties = Table(fill(15, total), [20, 85, 85], Point(200, 0)) -radius = 150 -text("radius = $radius", outerframe[1], halign=:center) +properties = Table(fill(15, total), [20, 85, 85], outerframe[1, 2]) +radius = 55 +sethue("grey20") for i in 3:total text(string(i), properties[i, 1], halign=:right) p = ngon(outerframe[1], radius, i, 0, vertices=true) - poly(p, :stroke, close=true) + prettypoly(p, :stroke, close=true, () -> (sethue("red"); circle(O, 2, :fill))) pa = polyarea(p) pp = polyperimeter(p) ppoverradius = pp/radius text(string(Int(round(pa, 0))), properties[i, 2], halign=:left) text(string(round(ppoverradius, 6)), properties[i, 3], halign=:left) + radius += 5 end fontsize(10) diff --git a/src/Table.jl b/src/Table.jl index 4ff77644..23bf2b1d 100644 --- a/src/Table.jl +++ b/src/Table.jl @@ -149,8 +149,8 @@ function Table(rowheights::Array{T, 1}, colwidths::Array{T, 1}, center=O) where ncols = length(colwidths) currentrow = 1 currentcol = 1 - leftmargin = -sum(colwidths)/2 - topmargin = -sum(rowheights)/2 + leftmargin = center.x - sum(colwidths)/2 + topmargin = center.y - sum(rowheights)/2 Table(rowheights, colwidths, nrows, ncols, currentrow, currentcol, leftmargin, topmargin, center) end