Alberi binomia

  • Creatore
    Topic
  • #105020
    Up
    0
    Down
    ::


    Salve a tutti! Vorrei chiedervi un consiglio: avrei bisogno di disegnare un albero binomiale di questo tipo, con ad ogni nodo più di un’informazione (su più righe). Qual è il pacchetto migliore da utilizzare?

    [attachment=1530]PyQmN.png[/attachment]

    Grazie mille

    Attachments:
    You must be logged in to view attached files.
Visualizzazione 3 filoni di risposte
  • Autore
    Risposte
    • #105021
      robitex
      Amministratore del forum
        Up
        0
        Down
        ::


        Ciao.
        Un pacchetto come Tikz/PGF ti consente di disegnare con una sintassi dei comandi user friendly con moltissime possibilità grafiche.
        Se non conosci TikZ è anche un’ottima occasione per cominciare che poi prima o poi serve.
        Se hai difficoltà, posta un esempio di codice e poni domande precise.
        Grazie.
        Buon lavoro.
        R.

      • #105022
        Up
        0
        Down
        ::


        Grazie mille!!
        Ho letto la guida, questo pacchetto è stupendo! Sono riuscita a disegnare gli alberi, ma ho un dubbio! Mi compare un punto subito dopo il riquadro dell’ultimo ramo, e non so come toglierlo!

        [attachment=1534]Schermata2016-02-14alle15.14.39.png[/attachment]

        `
        \begin{center}
        \tikz [font=\small,
        grow=right,
        level 1/.style={sibling distance=6em},
        level 2/.style={sibling distance=2em},
        level distance=3cm]
        \node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$A$} % root
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$D$}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$O$}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$N$}}
        child{node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$M$}}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$C$}
        child { node [shape=rectangle, rounded corners=1mm, draw, inner sep=4, text width=1cm, align=flush center] {$L$}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$I$}}
        child{node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$H$}}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$B$}
        child{node [shape=rectangle, rounded corners=1mm, draw, inner sep=4, text width=1cm, align=flush center] {$G$}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$F$}}
        child{node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$E$}}}
        \end{center}

        \begin{center}
        \tikz [font=\small,
        grow=right,
        level 1/.style={sibling distance=3em},
        level 2/.style={sibling distance=3em},
        level distance=3cm]
        \node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$A$} % root
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$D$}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$O$}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$N$}}
        child{node [shape=rectangle, rounded corners=1mm, inner sep=4, text width=1cm, align=flush center] {}}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$C$}
        child { node [shape=rectangle, rounded corners=1mm, inner sep=4, text width=1cm, align=flush center] {}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$I$}}
        child{node [shape=rectangle, rounded corners=1mm, inner sep=4, text width=1cm, align=flush center] {}}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$B$}
        child{node [shape=rectangle, rounded corners=1mm, inner sep=4, text width=1cm, align=flush center] {}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$F$}}
        child{node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$E$}}}
        \end{center}
        `

        (P.S. so di poter migliorare il codice ed evitare così di riscrivere le caratteristiche di ogni nodo in ogni riga, ci sto lavorando!)

        Inoltre, vorrei chiedervi se possibile mettere i due alberi affiancati.

        Davvero grazie!

        Attachments:
        You must be logged in to view attached files.
      • #105023
        Up
        0
        Down
        ::

        asym88″ post=105164Grazie mille!!
        Ho letto la guida, questo pacchetto è stupendo! Sono riuscita a disegnare gli alberi, ma ho un dubbio! Mi compare un punto subito dopo il riquadro dell’ultimo ramo, e non so come toglierlo!

        [attachment=1534]Schermata2016-02-14alle15.14.39.png[/attachment]

        `
        \begin{center}
        \tikz [font=\small,
        grow=right,
        level 1/.style={sibling distance=6em},
        level 2/.style={sibling distance=2em},
        level distance=3cm]
        \node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$A$} % root
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$D$}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$O$}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$N$}}
        child{node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$M$}}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$C$}
        child { node [shape=rectangle, rounded corners=1mm, draw, inner sep=4, text width=1cm, align=flush center] {$L$}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$I$}}
        child{node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$H$}}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$B$}
        child{node [shape=rectangle, rounded corners=1mm, draw, inner sep=4, text width=1cm, align=flush center] {$G$}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$F$}}
        child{node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$E$}}}
        \end{center}

        \begin{center}
        \tikz [font=\small,
        grow=right,
        level 1/.style={sibling distance=3em},
        level 2/.style={sibling distance=3em},
        level distance=3cm]
        \node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$A$} % root
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$D$}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$O$}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$N$}}
        child{node [shape=rectangle, rounded corners=1mm, inner sep=4, text width=1cm, align=flush center] {}}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$C$}
        child { node [shape=rectangle, rounded corners=1mm, inner sep=4, text width=1cm, align=flush center] {}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$I$}}
        child{node [shape=rectangle, rounded corners=1mm, inner sep=4, text width=1cm, align=flush center] {}}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$B$}
        child{node [shape=rectangle, rounded corners=1mm, inner sep=4, text width=1cm, align=flush center] {}}
        child { node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$F$}}
        child{node [shape=rectangle, rounded corners=1mm,draw, inner sep=4, text width=1cm, align=flush center] {$E$}}}
        \end{center}
        `

        (P.S. so di poter migliorare il codice ed evitare così di riscrivere le caratteristiche di ogni nodo in ogni riga, ci sto lavorando!)

        Inoltre, vorrei chiedervi se possibile mettere i due alberi affiancati.

        Davvero grazie!

        Il punto è probabilmente dovuto a un punto che hai lasciato nel codice: provando quello che hai allegato non compare. Per avere i grafi affiancati, puoi pensare di fare così: `\begin{center}


        \end{center}` Attenta: se i grafi sono grandi, puoi scalarne le dimensioni mettendo come opzioni al comando [tt]\tikz[/tt] [tt]scale=, transform shape[/tt].

        E, si, usando gli stili eviti di copiare e incollare tutte le volte le definizioni 😉

        Fra le guide della sezione documentazione, trovi anche L’Arte di disegnare con LaTeX: è un ottima guida, in italiano, per iniziare con TikZ.

        Ciao
        Claudio

      • #105024
        Up
        0
        Down
        ::


        Infinite grazie per la soluzione, sono riuscita a mettere i grafici affiancati!

        Il punto compare se metto l’albero centrato, non capisco perché ma proverò a risolvere!

        Leggo tutto!

        Grazie ancora!

    Visualizzazione 3 filoni di risposte
    • Devi essere connesso per rispondere a questo topic.

    Go to top