¿Existe alguna manera de hacer fácilmente un diagrama de barras como este en Latex?

¿Existe alguna manera de hacer fácilmente un diagrama de barras como este en Latex?

Estoy intentando crear un diagrama en Latex, pero es demasiado complicado para mi nivel de experiencia en Tikz. ¿Hay alguna manera de recrear este diagrama fácilmente? ¿O algún consejo sobre lo que debo hacer? ¡Gracias por cualquier ayuda que puedas brindar!

La imagen que estoy tratando de recrear.

Respuesta1

Es posible que tengas problemas para colocar esto en la página porque es muy ancha, pero aquí tienes una solución con forest.

ingrese la descripción de la imagen aquí

\documentclass{article}

\usepackage{forest}
\tikzset{circ/.style={label={[draw, circle, red, minimum size=2.5ex, inner sep=0pt]left:#1}}}

\begin{document}

\begin{forest}
for tree={math content, l*=.3, anchor=center, font=\footnotesize,
    if level>=2{l sep=1mm, if level>=3{no edge}{}}{l sep=2cm},
    s sep=4mm}
[{(A,B,C)}
    [\emptyset[\emptyset, circ=1]]
    [(A)[\{(A)\}, circ=2]]
    [(B)[\{(B)\}, circ=3]]
    [(C)[\{(C)\}, circ=4]]
    [{(A,B)}[{\{(A),(B)\}}, circ=5[{\{(A,B)\}}, circ=6]]]
    [{(A,C)}[{\{(A),(C)\}}, circ=7[{\{(A,C)\}}, circ=8]]]
    [{(B,C)}[{\{(B),(C)\}}, circ=9[{\{(B,C)\}}, circ=10]]]
    [{(A,B,C)}
        [{\{(A),(B),(C)\}}, circ=11[{\{(A,B),(C)\}}, circ=12[{\{(A,C),(B)\}}, circ=13[{\{(B,C),(A)\}}, circ=14[{\{(A,B,C)\}}, circ=15]]]]]]
]
\end{forest}

\end{document}

Respuesta2

Ha pasado mucho tiempo desde que usé TikZ sin geometría. Aquí una solución clásica (la respuesta de Sandy es perfecta). Solo tengo un problema, tal vez sea mejor alinear 10,11,12, etc. Usé el estilo de Sandy.

Actualización con alineación de los números rojos.

\documentclass[a4paper,10pt,landscape]{article}
\usepackage{tikz}
\tikzset{circ/.style={label={[draw, circle, red, minimum size=2.5ex, inner sep=0pt]left:#1}}}
\begin{document} 
\begin{tikzpicture} [font=\footnotesize,
grow=south, level 1/.style={sibling distance=6em, level distance=5cm},
level 2/.style={ level distance=2cm},
level 3/.style={ level distance=1.5em},
level 4/.style={ level distance=1.5em},
level 5/.style={ level distance=1.5em},
level 6/.style={ level distance=1.5em}]
\node {(A,B,C)} % root
    child { node {$\emptyset$}
      child { node[circ=1] {$\emptyset$}}
    }
    child { node {(A)}
      child { node[circ=2] {\{(A)\}}}
    }
    child { node {(B)}
      child { node[circ=3] {\{(B)\}}}
    }
    child { node {(C)}
      child { node[circ=4] {\{(C)\}}}
    }
    child { node {(A,B)}
      child {   node[circ=5,minimum width=1.5cm] {\{(A),(B)\}} 
        child { node[circ=6,minimum width=1.5cm] {\{(A,B)\}}}}
    }
    child { node {(A,C)}
      child { node[circ=7,minimum width=1.5cm] {\{(A),(C)\}} 
        child {node[circ=8,minimum width=1.5cm] {\{(A,C)\} }}}
    }
    child { node {(B,C)}
      child { node[circ=9,minimum width=1.5cm] {\{(B),(C)\}} 
        child {node[circ=10,minimum width=1.5cm] {\{(B,C)\}}}}
    }
    child { node {(A,B,C)}
      child { node[circ=11,minimum width=2cm] {\{(A),(B),(C)\}} 
        child {node[circ=12,minimum width=2cm] {\{(A,B),(C)\}}  
         child {node[circ=13,minimum width=2cm] {\{(A,C),(B)\}} 
           child {node[circ=14,minimum width=2cm] {\{(B,C),(A)\}} 
             child {node[circ=15,minimum width=2cm] {\{(A,B,C)\}}}}}}}
};

\end{tikzpicture}
\end{document}

ingrese la descripción de la imagen aquí

Respuesta3

recomiendo usarMathcha. Allí, puede dibujar seleccionando la opción 'Insertar diagrama' y eligiendo la opción 'Área de dibujo' para mostrar el área de dibujo en el lado derecho. Estoy compartiendo un código que es similar a su diagrama. Puedes exportar tu trabajo como imagen o en formato TikZ usando esta plataforma. Recomiendo elegir la opción TikZ para una mejor calidad.

\documentclass{article}

\usepackage{tikz}

\begin{document}

\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        

\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,296); %set diagram left start at 0, and has height of 296

%Straight Lines [id:da842538810449589] 
\draw    (381.88,44.88) -- (353.08,112.48) ;
%Straight Lines [id:da7257564806335599] 
\draw    (434.88,130.36) -- (434.88,179.56) ;
%Straight Lines [id:da20949947181562223] 
\draw    (349.88,130.36) -- (349.88,179.56) ;
%Straight Lines [id:da2593651135736319] 
\draw    (518.68,130.16) -- (518.68,179.36) ;
%Straight Lines [id:da7741353868078296] 
\draw    (281.88,131.36) -- (281.88,180.56) ;
%Straight Lines [id:da9720425366631544] 
\draw    (227.88,130.96) -- (227.88,180.16) ;
%Straight Lines [id:da581739553085237] 
\draw    (173.88,131.36) -- (173.88,180.56) ;
%Straight Lines [id:da8464131628402256] 
\draw    (120.68,130.56) -- (120.68,179.76) ;
%Straight Lines [id:da058139682734349885] 
\draw    (614.48,129.76) -- (614.48,178.96) ;
%Straight Lines [id:da4017264009317001] 
\draw    (177.4,111.13) -- (356.28,44.88) ;
%Straight Lines [id:da7610123999802281] 
\draw    (229.72,110.88) -- (365.88,44.88) ;
%Straight Lines [id:da2905799653222627] 
\draw    (123.32,112.48) -- (352.6,40.67) ;
%Straight Lines [id:da9847257278990789] 
\draw    (283.88,110.08) -- (374.68,44.88) ;
%Straight Lines [id:da09133555586008946] 
\draw    (389.48,44.88) -- (435.48,110.88) ;
%Straight Lines [id:da06694033598480398] 
\draw    (397.88,44.48) -- (518.33,110.53) ;
%Straight Lines [id:da5575718778158445] 
\draw    (408.28,43.68) -- (612.68,110.48) ;

% Text Node
\draw (351.4,24.4) node [anchor=north west][inner sep=0.75pt]    {$( A,B,C)$};
% Text Node
\draw (269.87,112.2) node [anchor=north west][inner sep=0.75pt]    {$( C)$};
% Text Node
\draw (329.67,112.07) node [anchor=north west][inner sep=0.75pt]    {$( A,B)$};
% Text Node
\draw (413.2,112.2) node [anchor=north west][inner sep=0.75pt]    {$( A,C)$};
% Text Node
\draw (262.48,182.68) node [anchor=north west][inner sep=0.75pt]    {$\{( C)\}$};
% Text Node
\draw (316.48,182.28) node [anchor=north west][inner sep=0.75pt]    {$\{( A) ,( B)\}$};
% Text Node
\draw (317.28,202.08) node [anchor=north west][inner sep=0.75pt]    {$\{( A,B)\}$};
% Text Node
\draw (400.68,182.68) node [anchor=north west][inner sep=0.75pt]    {$\{( A) ,( C)\}$};
% Text Node
\draw (401.08,202.28) node [anchor=north west][inner sep=0.75pt]    {$\{( A,C)\}$};
% Text Node
\draw (498.47,111.87) node [anchor=north west][inner sep=0.75pt]    {$( B,C)$};
% Text Node
\draw (485.28,182.08) node [anchor=north west][inner sep=0.75pt]    {$\{( B) ,( C)\}$};
% Text Node
\draw (485.08,201.88) node [anchor=north west][inner sep=0.75pt]    {$\{( B,C)\}$};
% Text Node
\draw (215.87,111.8) node [anchor=north west][inner sep=0.75pt]    {$( B)$};
% Text Node
\draw (208.48,182.28) node [anchor=north west][inner sep=0.75pt]    {$\{( B)\}$};
% Text Node
\draw (161.87,112.2) node [anchor=north west][inner sep=0.75pt]    {$( A)$};
% Text Node
\draw (154.48,182.68) node [anchor=north west][inner sep=0.75pt]    {$\{( A)\}$};
% Text Node
\draw (114.27,111.8) node [anchor=north west][inner sep=0.75pt]    {$\emptyset $};
% Text Node
\draw (113.87,182.2) node [anchor=north west][inner sep=0.75pt]    {$\emptyset $};
% Text Node
\draw (581.2,111) node [anchor=north west][inner sep=0.75pt]    {$( A,B,C)$};
% Text Node
\draw (568.68,181.48) node [anchor=north west][inner sep=0.75pt]    {$\{( A) ,( B) ,( C)\}$};
% Text Node
\draw (569.08,202.08) node [anchor=north west][inner sep=0.75pt]    {$\{( A,B) ,( C)\}$};
% Text Node
\draw (569.08,221.88) node [anchor=north west][inner sep=0.75pt]    {$\{( A,C) ,( B)\}$};
% Text Node
\draw (568.88,241.88) node [anchor=north west][inner sep=0.75pt]    {$\{( B,C) ,( A)\}$};
% Text Node
\draw (569.21,261.81) node [anchor=north west][inner sep=0.75pt]    {$\{( A,B,C)\}$};
% Text Node
\draw (32,174.33) node [anchor=north west][inner sep=0.75pt]   [align=left] {\begin{minipage}[lt]{44.12pt}\setlength\topsep{0pt}
\begin{center}
Possible \\Groups
\end{center}

\end{minipage}};
% Text Node
\draw (14.67,100) node [anchor=north west][inner sep=0.75pt]   [align=left] {\begin{minipage}[lt]{58.85pt}\setlength\topsep{0pt}
\begin{center}
Participating\\Schools
\end{center}

\end{minipage}};
% Text Node
\draw (206.07,16.4) node [anchor=north west][inner sep=0.75pt]   [align=left] {\begin{minipage}[lt]{49.78pt}\setlength\topsep{0pt}
\begin{center}
Schools in\\District
\end{center}

\end{minipage}};

\end{tikzpicture}
\end{document}

Obtendrá el siguiente resultado cuando utilice el código anterior.

ingrese la descripción de la imagen aquí

información relacionada