Ign*_*rov 9 haskell haskell-diagrams
I am trying to put several diagrams together in a kind of a table. I think this is called "index print", photography people do that when they have to review many photographs at once. Anyway, this is the code:
main :: IO ()
main = mainWith @(Diagram B)
$ (tile . fmap renderOne) examples
renderOne :: AnyGraph -> Diagram B
renderOne (AnyGraph gr) = ...
tile :: [Diagram B] -> Diagram B
tile xs = let columns = (ceiling . sqrt . fromIntegral . length) xs
in (vcat . fmap hcat . List.chunksOf columns) xs
Run Code Online (Sandbox Code Playgroud)
It does not work as I expect. But let us approach it gradually. First, here is a render of a single tile:
Now, let us hcat four tiles together.
Add a second row: (See how scale invariant features thicken.)
And this is how it looks with 4 rows:
Out of hand!
It seems to me that scale invariant features, such as arrow heads, are scaled in proportion to the area of the picture. But in this case, I need to grow my diagram without re-scaling those features. How can I achieve that?
您想要查看的是关于测量单位的用户手册部分。默认情况下,箭头之类的东西以“规格化”单位进行度量,并对其进行缩放,以使它们始终是整个图片大小的恒定比例。如果我正确理解了您的用例,我认为您可能想使用本地单位。使用您正在使用的任何箭头功能的带底漆的变体,并给它一个选项,记录类似
(with & headLength .~ local 0.1)
Run Code Online (Sandbox Code Playgroud)
但无论多少,都可以使您的图片看起来像您想要的样子。有关箭头选项的更多信息,请参见箭头教程。