Skip to content

Commit

Permalink
dim2_layout and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
scheinerman committed Sep 2, 2024
1 parent 64e9fac commit 673d373
Show file tree
Hide file tree
Showing 16 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
LayeredLayouts = "f4a74d36-062a-4d48-97cd-1356bad1de4e"

Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"


[compat]
Expand Down
Binary file modified basic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dim2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/build/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-02T10:55:08","documenter_version":"1.6.0"}}
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-02T15:15:13","documenter_version":"1.6.0"}}
Binary file modified docs/build/basic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/build/dim2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
julia> h = HasseDiagram(p)
Hasse diagram of a {8, 19} Int64 poset

julia&gt; draw(h)</code></pre><h2 id="Creating-a-Layout"><a class="docs-heading-anchor" href="#Creating-a-Layout">Creating a Layout</a><a id="Creating-a-Layout-1"></a><a class="docs-heading-anchor-permalink" href="#Creating-a-Layout" title="Permalink"></a></h2><p>When a Hasse diagram is created, it is given a default layout. Hasse diagrams can be given an alternative layout with the function <code>set_xy!</code>. There are two forms:</p><ul><li><code>set_xy!(h, method)</code> uses the function <code>method</code> to compute the layout. The function acts on the posets held inside <code>h</code>. The list of available layout methods is in the next section. </li><li><code>set_xy!(h, xy)</code> uses the dictionary <code>xy</code> to site the vertices. Vertex <code>v</code> is placed at <code>xy[v]</code>. If <code>v</code> is not a key of <code>xy</code>, then its location is unchanged.</li></ul><h3 id="Scaling"><a class="docs-heading-anchor" href="#Scaling">Scaling</a><a id="Scaling-1"></a><a class="docs-heading-anchor-permalink" href="#Scaling" title="Permalink"></a></h3><p>The function <code>scale!(p,μ)</code> multiplies all coordinates in the embedding by <code>μ</code>. It is likely more useful just to multiply the <code>x</code>- or <code>y</code>-coordinates; to do so, use <code>scalex!</code> or <code>scaley!</code>, respecitvely. </p><h2 id="Layout-Methods"><a class="docs-heading-anchor" href="#Layout-Methods">Layout Methods</a><a id="Layout-Methods-1"></a><a class="docs-heading-anchor-permalink" href="#Layout-Methods" title="Permalink"></a></h2><ul><li><code>basic_layout</code> places vertices vertically based on their rank and, within each rank, the horizontal placement is evenly spaced.</li><li><code>dim2_layout</code> is a decent layout function that is applicable to posets whose dimension is at most two. Reasonbly quick. In the poset has dimension greater than two, a reasonable alternative is presented. </li><li><code>layered_layout</code> is a Sugiyaqma style layout from the <a href="https://github.com/oxinabox/LayeredLayouts.jl">LayeredLayouts</a> module. Can be slow. </li></ul><h2 id="Sample-Results"><a class="docs-heading-anchor" href="#Sample-Results">Sample Results</a><a id="Sample-Results-1"></a><a class="docs-heading-anchor-permalink" href="#Sample-Results" title="Permalink"></a></h2><p>Results for a randomly generated two-dimensional poset:</p><p><img src="basic.png" alt/></p><p><img src="dim2.png" alt/></p><p><img src="layered.png" alt/></p><h2 id="Properties"><a class="docs-heading-anchor" href="#Properties">Properties</a><a id="Properties-1"></a><a class="docs-heading-anchor-permalink" href="#Properties" title="Permalink"></a></h2><h4 id="Font-size"><a class="docs-heading-anchor" href="#Font-size">Font size</a><a id="Font-size-1"></a><a class="docs-heading-anchor-permalink" href="#Font-size" title="Permalink"></a></h4><ul><li>Use <code>set_font_size!(h, sz)</code> to set labels to be <code>sz</code> points. Use <code>0</code> to hide labels. Default is <code>FONT_SIZE = 10</code>.</li><li>Use <code>get_font_size(h)</code> to determine the current font size for <code>h</code>. </li></ul><h4 id="Node-radius"><a class="docs-heading-anchor" href="#Node-radius">Node radius</a><a id="Node-radius-1"></a><a class="docs-heading-anchor-permalink" href="#Node-radius" title="Permalink"></a></h4><ul><li>Use <code>set_radius!(h, r)</code> to set the size of the circles that represent the elements of the poset. Default is <code>RADIUS = 12</code>.</li><li>Use <code>get_radius(h)</code> to determine the current radius.</li></ul><h4 id="Fill-color"><a class="docs-heading-anchor" href="#Fill-color">Fill color</a><a id="Fill-color-1"></a><a class="docs-heading-anchor-permalink" href="#Fill-color" title="Permalink"></a></h4><ul><li>Use <code>set_fill_color!(h, c)</code> to set the fill color for the circles to <code>c</code>. Default is <code>FILL_COLOR = :white</code>. All circles are filled with the same color. </li><li>Use <code>get_fill_color(h)</code> to determine the current color. </li></ul><h2 id="Example"><a class="docs-heading-anchor" href="#Example">Example</a><a id="Example-1"></a><a class="docs-heading-anchor-permalink" href="#Example" title="Permalink"></a></h2><p>Here is an example for drawing (small) subset lattices with sensible labels. Here is the function to produce the picture:</p><pre><code class="language-julia hljs">using Posets, HasseDiagrams, SimpleDrawing, ShowSet
julia&gt; draw(h)</code></pre><h2 id="Creating-a-Layout"><a class="docs-heading-anchor" href="#Creating-a-Layout">Creating a Layout</a><a id="Creating-a-Layout-1"></a><a class="docs-heading-anchor-permalink" href="#Creating-a-Layout" title="Permalink"></a></h2><p>When a Hasse diagram is created, it is given a default layout. Hasse diagrams can be given an alternative layout with the function <code>set_xy!</code>. There are two forms:</p><ul><li><code>set_xy!(h, method)</code> uses the function <code>method</code> to compute the layout. The function acts on the posets held inside <code>h</code>. The list of available layout methods is in the next section. </li><li><code>set_xy!(h, xy)</code> uses the dictionary <code>xy</code> to site the vertices. Vertex <code>v</code> is placed at <code>xy[v]</code>. If <code>v</code> is not a key of <code>xy</code>, then its location is unchanged.</li></ul><h3 id="Scaling"><a class="docs-heading-anchor" href="#Scaling">Scaling</a><a id="Scaling-1"></a><a class="docs-heading-anchor-permalink" href="#Scaling" title="Permalink"></a></h3><p>The function <code>scale!(p,μ)</code> multiplies all coordinates in the embedding by <code>μ</code>. It is likely more useful just to multiply the <code>x</code>- or <code>y</code>-coordinates; to do so, use <code>scalex!</code> or <code>scaley!</code>, respecitvely. </p><h2 id="Layout-Methods"><a class="docs-heading-anchor" href="#Layout-Methods">Layout Methods</a><a id="Layout-Methods-1"></a><a class="docs-heading-anchor-permalink" href="#Layout-Methods" title="Permalink"></a></h2><ul><li><code>basic_layout</code> places vertices vertically based on their rank and, within each rank, the horizontal placement is evenly spaced.</li><li><code>dim2_layout</code> is a decent layout function that is applicable to posets whose dimension is at most two. Reasonbly quick. If the poset has dimension greater than two, a reasonable alternative is presented. </li><li><code>layered_layout</code> is a Sugiyaqma style layout from the <a href="https://github.com/oxinabox/LayeredLayouts.jl">LayeredLayouts</a> module. Can be slow. </li></ul><h2 id="Sample-Results"><a class="docs-heading-anchor" href="#Sample-Results">Sample Results</a><a id="Sample-Results-1"></a><a class="docs-heading-anchor-permalink" href="#Sample-Results" title="Permalink"></a></h2><p>Results for a randomly generated two-dimensional poset:</p><p><img src="basic.png" alt/></p><p><img src="dim2.png" alt/></p><p><img src="layered.png" alt/></p><h2 id="Properties"><a class="docs-heading-anchor" href="#Properties">Properties</a><a id="Properties-1"></a><a class="docs-heading-anchor-permalink" href="#Properties" title="Permalink"></a></h2><h4 id="Font-size"><a class="docs-heading-anchor" href="#Font-size">Font size</a><a id="Font-size-1"></a><a class="docs-heading-anchor-permalink" href="#Font-size" title="Permalink"></a></h4><ul><li>Use <code>set_font_size!(h, sz)</code> to set labels to be <code>sz</code> points. Use <code>0</code> to hide labels. Default is <code>FONT_SIZE = 10</code>.</li><li>Use <code>get_font_size(h)</code> to determine the current font size for <code>h</code>. </li></ul><h4 id="Node-radius"><a class="docs-heading-anchor" href="#Node-radius">Node radius</a><a id="Node-radius-1"></a><a class="docs-heading-anchor-permalink" href="#Node-radius" title="Permalink"></a></h4><ul><li>Use <code>set_radius!(h, r)</code> to set the size of the circles that represent the elements of the poset. Default is <code>RADIUS = 12</code>.</li><li>Use <code>get_radius(h)</code> to determine the current radius.</li></ul><h4 id="Fill-color"><a class="docs-heading-anchor" href="#Fill-color">Fill color</a><a id="Fill-color-1"></a><a class="docs-heading-anchor-permalink" href="#Fill-color" title="Permalink"></a></h4><ul><li>Use <code>set_fill_color!(h, c)</code> to set the fill color for the circles to <code>c</code>. Default is <code>FILL_COLOR = :white</code>. All circles are filled with the same color. </li><li>Use <code>get_fill_color(h)</code> to determine the current color. </li></ul><h2 id="Example"><a class="docs-heading-anchor" href="#Example">Example</a><a id="Example-1"></a><a class="docs-heading-anchor-permalink" href="#Example" title="Permalink"></a></h2><p>Here is an example for drawing (small) subset lattices with sensible labels. Here is the function to produce the picture:</p><pre><code class="language-julia hljs">using Posets, HasseDiagrams, SimpleDrawing, ShowSet

function draw_bool(k)
p = subset_lattice(k)
Expand All @@ -21,4 +21,4 @@
set_xy!(h, layered_layout)
draw(h)
expand_canvas() # from SimpleDrawing
end</code></pre><p>Here is the result of <code>draw_bool(4)</code>:</p><p><img src="bool4.png" alt/></p></article><nav class="docs-footer"><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Monday 2 September 2024 10:55">Monday 2 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
end</code></pre><p>Here is the result of <code>draw_bool(4)</code>:</p><p><img src="bool4.png" alt/></p></article><nav class="docs-footer"><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Monday 2 September 2024 15:15">Monday 2 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Binary file modified docs/build/layered.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 673d373

Please sign in to comment.