Haskell的边距图SVG文件

qed*_*qed 3 graphics haskell haskell-diagrams

我正在尝试这个图示例:

funs          = map (flip (^)) [2..6]
visualize f   = stroke' (with & vertexNames .~ [[0 .. 6 :: Int]] )
                    (regPoly 7 1)
                  # lw none
                  # showLabels
                  # fontSize (Local 0.6)
             <> star (StarFun f) (regPoly 7 1)
                  # stroke # lw thick # lc red
example       = center . hcat' (with & sep .~ 0.5) $ map visualize funs
Run Code Online (Sandbox Code Playgroud)

这是结果:

在此输入图像描述

一切看起来都像预期的那样,一些数字(或更确切地说,这些数字的中心)位于图像边缘附近,所以最后它们看起来像被切断了.

有办法解决这个问题吗?

cch*_*ers 9

问题是文本没有信封,所以不考虑它的大小.您可以使用frame为信封添加边框的功能来解决您的问题.

example = frame 2 . center . hcat' (with & sep .~ 5) $ map visualize funs
Run Code Online (Sandbox Code Playgroud)

例