Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pimp lua examples (addresses issues #640 #839) #883

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 77 additions & 28 deletions tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentAlign.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,18 @@ declare {
than one node of a component, the node encountered first in the
component is used.
"]],
examples = [["
\tikz \graph [binary tree layout, nodes={draw}]
{ a, b -- c[align here], d -- e[second, align here] -- f };
"]]
examples = {{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [binary tree layout, nodes={draw}]
{ a, b -- c[align here], d -- e[second, align here] -- f };
"]],
}}
}

---
Expand Down Expand Up @@ -200,11 +208,19 @@ declare {
suggest, the components will be placed left-to-right and they are
aligned such that their top nodes are in a line.
"]],
examples = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go right top aligned]
{ a, "high\\node" -- b};
"]]
examples = {{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go right top aligned]
{ a, "high\\node" -- b};
"]]
}}
}

---
Expand All @@ -222,11 +238,19 @@ declare {
This means that the components will be aligned with their bounding
boxed being top-aligned.
"]],
examples = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go right absolute top aligned]
{ a, "high\\node" -- b};
"]]
examples = {{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go right absolute top aligned]
{ a, "high\\node" -- b};
"]]
}}
}

---
Expand Down Expand Up @@ -295,11 +319,19 @@ declare {

summary = "See the other |components go ...| keys.",

examples = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go left top aligned]
{ a, "high\\node" -- b};
"]]
examples = {{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go left top aligned]
{ a, "high\\node" -- b};
"]]
}}
}

---
Expand Down Expand Up @@ -381,15 +413,32 @@ declare {
},
summary = "See the other |components go ...| keys.",

examples = {[["
\tikz \graph [tree layout, nodes={draw, align=center},
components go down left aligned]
{ a, hello -- {world,s} };
"]],[["
\tikz \graph [tree layout, nodes={draw, align=center},
components go up absolute left aligned]
{ a, hello -- {world,s}};
"]]
examples = {
{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go down left aligned]
{ a, hello -- {world,s} };
"]]
},{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go up absolute left aligned]
{ a, hello -- {world,s}};
"]]
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,44 @@ declare {
by this option in any way. You can use the |grow| option or |orient|
options to orient individual components.
"]],
examples = {[["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component direction=left]
{ a, b, c -- d -- e, f -- g };
"]],[["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component direction=10]
{ a, b, c -- d -- e, f -- g };
"]],[["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component direction=up]
{ a, b, c [grow=right] -- d -- e, f[grow=45] -- g };
"]]
examples = {
{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component direction=left]
{ a, b, c -- d -- e, f -- g };
"]]
},{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component direction=10]
{ a, b, c -- d -- e, f -- g };
"]]
},{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component direction=up]
{ a, b, c [grow=right] -- d -- e, f[grow=45] -- g };
"]]
}
}
}

Expand Down
53 changes: 39 additions & 14 deletions tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentOrder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,32 @@ declare {
As above, but in decreasing order.
\end{itemize}
"]],
examples = {[["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component order=by first specified node]
{ a, b, c, f -- g, c -- d -- e };
"]],[["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component order=increasing node number]
{ a, b, c -- d -- e, f -- g };
"]]
examples = {
{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component order=by first specified node]
{ a, b, c, f -- g, c -- d -- e };
"]]
},{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component order=increasing node number]
{ a, b, c -- d -- e, f -- g };
"]]
}
}
}

Expand Down Expand Up @@ -94,11 +111,19 @@ declare {
summary = [["
A shorthand for |component order=decreasing node number|.
"]],
examples = [["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
large components first]
{ a, b, c -- d -- e, f -- g };
"]]
examples = {{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
large components first]
{ a, b, c -- d -- e, f -- g };
"]]
}}
}


Expand Down
43 changes: 30 additions & 13 deletions tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Components.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,36 @@ declare {
support laying out unconnected graphs, this option has no effect;
rather it works as if this option were always set.
"]],
examples = {[["
\tikz \graph [simple necklace layout]
{
a -- b -- c -- d -- a,
1 -- 2 -- 3 -- 1
};
"]],[[",
\tikz \graph [simple necklace layout, componentwise]
{
a -- b -- c -- d -- a,
1 -- 2 -- 3 -- 1
};
"]]
examples = {
{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{circular}
},
"]],
code = [["
\tikz \graph [simple necklace layout]
{
a -- b -- c -- d -- a,
1 -- 2 -- 3 -- 1
};
"]]
},{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{circular}
},
"]],
code = [[",
\tikz \graph [simple necklace layout, componentwise]
{
a -- b -- c -- d -- a,
1 -- 2 -- 3 -- 1
};
"]]
}
}
}

Expand Down
Loading