I'm trying to save space in diagrams, so I want to know if there's an easy way to make a forest tree folder grow to right and left sides as seen in the image below
Currently I have this but I've no idea on how to manipulate growing of forest.
\documentclass{article}
\usepackage[letterpaper,margin=20mm]{geometry}
\usepackage{tikz}
\usepackage[edges]{forest}
\usepackage{xcolor}
\usetikzlibrary{shapes.geometric, arrows.meta, calc, patterns, patterns.meta, shadows}
\pgfkeys{/forest,
rect/.append style={rectangle, rounded corners=2pt, /tikz/align=center},
}
\definecolor{background}{RGB}{239, 239, 239}
\definecolor{lightgreen}{RGB}{150, 240, 180}
\definecolor{green}{RGB}{146, 208, 80}
\definecolor{blue}{RGB}{4, 121, 181}
\definecolor{linecol}{RGB}{92, 92, 92}
\definecolor{lightpink}{RGB}{245, 160, 240}
\definecolor{lightblue}{RGB}{176, 221, 255}
\definecolor{lilac}{RGB}{174, 182, 211}
\begin{document}
\begin{figure}
\centering
\begin{forest}
for tree={
line width=0.5pt,
draw=linecol,
rect,
calign=center,
minimum size=25pt,
text width=50mm,
rounded corners=5pt,
child anchor=north,
parent anchor=south,
drop shadow,
l sep+=12.5pt,
inner color=background,
anchor=center,
edge path={
\noexpand\path[color=linecol, rounded corners=5pt,>={Stealth[length=10pt]}, line width=0.5pt, ->, \forestoption{edge}]
(!u.parent anchor) -- +(0,-5pt) -|
(.child anchor)\forestoption{edge label};
},
if = {level == 1}{outer color=lightblue, text width=38mm}{},
if = {level == 2}{
outer color=lightgreen,
for tree = {
text width=28mm,
child anchor=west
}
}{},
if = {level == 3}{outer color=lightpink, text width=12mm,}{}
}
[Clasificación, outer color=lilac,
for tree = {
for children = {
grow'=0,
folder
}
}
[Térmicos
[Adición
[MSF][MED][MVC][HDH][SD]
]
[Extracción [Frz]]
]
[Membrana
[RO][FO][ED][NF]
]
[Químicos
[I.Ex][LLE][G. Hyd][Otros]
]
[Adsorción]
]
\end{forest}
\end{figure}
\end{document}
EDIT:
I think the solution could lie in the use of:
for children = {
if={mod(n,2)==0}{circle}{}
}
But it doesn't appear to change when I use grow'=east nor grow'=west
[Adición,
for children = {
if={mod(n,2)==0}{
for parent = {grow'=west}
}{
for parent = {grow'=east}
}
}
[MSF][MED][MVC][HDH][SD]
]
And if it's possible, how to center "clasificación"



forestmay not know where things are. – cfr Aug 15 '23 at 01:26multiple directionscode could work if you're careful. Or you could create the smaller side elsewhere and then move it into position later. – cfr Aug 15 '23 at 02:02