Problema con file .mp

  • Creatore
    Topic
  • #90281
    Up
    0
    Down
    ::


    Salve a tutti, sono nuovo del mondo Context. Sto iniziando ad usarlo per la tesi. Purtroppo ho un file che mi da problemi di compilazione, ma non riesco a capire dove sia l’errore, potreste darmi gentilmente una mano?

    `
    input graph
    u=0.5cm;
    beginfig(0);
    draw dashpattern(on 5bp);
    picture pa;
    pa=currentpicture;
    currentpicture:=nullpicture;
    draw dashpattern(on 5bp off 2bp);
    picture pb;
    pb=currentpicture;
    currentpicture:=nullpicture;
    draw dashpattern(on 1bp off 2bp);
    picture pc;
    pc=currentpicture;
    currentpicture:=nullpicture;
    draw dashpattern(on 5bp off 2bp on 1bp off 2bp);
    picture pd;
    pd=currentpicture;
    currentpicture:=nullpicture;
    draw dashpattern(on 5bp off 2bp on 5bp off 2bp on 1bp off 2bp on 1bp off 2bp);
    picture pe;
    pe=currentpicture;
    currentpicture:=nullpicture;
    draw dashpattern(on 5bp off 2bp on 5bp off 2bp on 1bp off 2bp );
    picture pf;
    pf=currentpicture;
    currentpicture:=nullpicture;
    draw dashpattern(on 1bp off 2bp on 1bp off 2bp on 5bp off 2bp );
    picture pg;
    pg=currentpicture;
    currentpicture:=nullpicture;
    draw begingraph(6cm,6cm);
    glabel.lft(btex Throughput (bps) etex rotated 90, OUT);
    glabel.bot(btex sources etex, OUT);
    gdraw “thr_olsrmos_20_30_300_0.05_1.txt” withcolor 0.75black dashed pa;
    draw (12, 1)*u–(14, 1)*u withcolor 0.75black dashed pa;
    label.bot(btex T=1 \Delta=0.05 etex scaled 0.5, (13, 1)*u);
    label.top(btex OLSR-MOS: etex scaled 0.5, (13, 2)*u);
    gdraw “thr_olsr_20_30_300.txt” withcolor 0.75red;
    draw (12, 8)*u–(14, 8)*u withcolor 0.75red;
    label.bot(btex OLSR etex scaled 0.5, (13, 8)*u);
    autogrid(grid.bot,grid.lft) withcolor 0.95white;
    frame.llft;
    gdraw “thr_olsrmos_20_30_300_0.05_1.txt” withcolor 0.75black dashed pa;
    draw (12, 1)*u–(14, 1)*u withcolor 0.75black dashed pa;
    label.bot(btex T=1 \Delta=0.05 etex scaled 0.5, (13, 1)*u);
    label.top(btex OLSR-MOS: etex scaled 0.5, (13, 2)*u);
    gdraw “thr_olsr_20_30_300.txt” withcolor 0.75red;
    draw (12, 8)*u–(14, 8)*u withcolor 0.75red;
    label.bot(btex OLSR etex scaled 0.5, (13, 8)*u);
    endgraph;
    endfig;
    end

    `

    [attachment=813]ftt_olsrmos_20_30_300_0.05_1.txt[/attachment]

    [attachment=814]ftt_olsr_20_30_300.txt[/attachment]

    [attachment=815]ftt_olsr_20_30_300_2013-11-12.txt[/attachment]

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

        giuseppegerax” post=89822Salve a tutti, sono nuovo del mondo Context. Sto iniziando ad usarlo per la tesi. Purtroppo ho un file che mi da problemi di compilazione, ma non riesco a capire dove sia l’errore, potreste darmi gentilmente una mano?

        `
        input graph
        u=0.5cm;
        beginfig(0);
        draw dashpattern(on 5bp);
        picture pa;
        pa=currentpicture;
        currentpicture:=nullpicture;
        draw dashpattern(on 5bp off 2bp);
        picture pb;
        pb=currentpicture;
        currentpicture:=nullpicture;
        draw dashpattern(on 1bp off 2bp);
        picture pc;
        pc=currentpicture;
        currentpicture:=nullpicture;
        draw dashpattern(on 5bp off 2bp on 1bp off 2bp);
        picture pd;
        pd=currentpicture;
        currentpicture:=nullpicture;
        draw dashpattern(on 5bp off 2bp on 5bp off 2bp on 1bp off 2bp on 1bp off 2bp);
        picture pe;
        pe=currentpicture;
        currentpicture:=nullpicture;
        draw dashpattern(on 5bp off 2bp on 5bp off 2bp on 1bp off 2bp );
        picture pf;
        pf=currentpicture;
        currentpicture:=nullpicture;
        draw dashpattern(on 1bp off 2bp on 1bp off 2bp on 5bp off 2bp );
        picture pg;
        pg=currentpicture;
        currentpicture:=nullpicture;
        draw begingraph(6cm,6cm);
        glabel.lft(btex Throughput (bps) etex rotated 90, OUT);
        glabel.bot(btex sources etex, OUT);
        gdraw “thr_olsrmos_20_30_300_0.05_1.txt” withcolor 0.75black dashed pa;
        draw (12, 1)*u–(14, 1)*u withcolor 0.75black dashed pa;
        label.bot(btex T=1 \Delta=0.05 etex scaled 0.5, (13, 1)*u);
        label.top(btex OLSR-MOS: etex scaled 0.5, (13, 2)*u);
        gdraw “thr_olsr_20_30_300.txt” withcolor 0.75red;
        draw (12, 8)*u–(14, 8)*u withcolor 0.75red;
        label.bot(btex OLSR etex scaled 0.5, (13, 8)*u);
        autogrid(grid.bot,grid.lft) withcolor 0.95white;
        frame.llft;
        gdraw “thr_olsrmos_20_30_300_0.05_1.txt” withcolor 0.75black dashed pa;
        draw (12, 1)*u–(14, 1)*u withcolor 0.75black dashed pa;
        label.bot(btex T=1 \Delta=0.05 etex scaled 0.5, (13, 1)*u);
        label.top(btex OLSR-MOS: etex scaled 0.5, (13, 2)*u);
        gdraw “thr_olsr_20_30_300.txt” withcolor 0.75red;
        draw (12, 8)*u–(14, 8)*u withcolor 0.75red;
        label.bot(btex OLSR etex scaled 0.5, (13, 8)*u);
        endgraph;
        endfig;
        end

        `

        [attachment=813]ftt_olsrmos_20_30_300_0.05_1.txt[/attachment]

        [attachment=814]ftt_olsr_20_30_300.txt[/attachment]

        [attachment=815]ftt_olsr_20_30_300_2013-11-12.txt[/attachment]

        Ciao,
        ho fatto girare il tuo codice con TeX Live 2013 ed ho ottenuto un errore su una funzione non definita per un valore numerico.
        Se vuoi davvero usare Metapost per produrre un grafico, e non vuoi usare un pacchetto molto più semplice e potente come pgfplots, ti consiglio di postare un listato più semplice che riproduca l’errore e riportarne la dicitura.

        Detto questo, aggiungo che le definizioni iniziali non sono eleganti in quanto definiscono una figura (picture) solo per usarla come pattern di tratteggio, quando forse un semplice path risponde direttamente al concetto.
        Ti segnalo anche che Metapost non dipende da ConTeXt, è solo che quest’ultimo formato dispone di funzioni più efficaci rispetto a LaTeX per gestire Metapost.
        Riassumendo:
        1 – il codice che hai postato è troppo complesso per permettere di capire facilmente il tuo problema;
        2 – citi ConTeXt ma il codice è Metapost puro, lasciando pensare che la tua conoscenza difetti di concetti di base;
        3 – potresti prendere in considerazione pacchetti come pgfplots, molto più efficaci rispetto alla libreria graph di Metapost;

        A risentirci.
        R.

        Personalmente ritengo Metapost un buon strumento per la grafica perché puoi risolvere facilmente equazioni lineari per la geometria e puoi programmare. Qualche esempio lo trovi sul mo blog.

      • #90283
        Up
        0
        Down
        ::

        giuseppegerax” post=89822Salve a tutti, sono nuovo del mondo Context. Sto iniziando ad usarlo per la tesi. Purtroppo ho un file che mi da problemi di compilazione, ma non riesco a capire dove sia l’errore, potreste darmi gentilmente una mano?

        `
        input graph
        u=0.5cm;
        beginfig(0);
        draw dashpattern(on 5bp);
        picture pa;
        pa=currentpicture;
        currentpicture:=nullpicture;
        draw dashpattern(on 5bp off 2bp);
        picture pb;
        pb=currentpicture;
        currentpicture:=nullpicture;
        draw dashpattern(on 1bp off 2bp);
        picture pc;
        pc=currentpicture;
        currentpicture:=nullpicture;
        draw dashpattern(on 5bp off 2bp on 1bp off 2bp);
        picture pd;
        pd=currentpicture;
        currentpicture:=nullpicture;
        draw dashpattern(on 5bp off 2bp on 5bp off 2bp on 1bp off 2bp on 1bp off 2bp);
        picture pe;
        pe=currentpicture;
        currentpicture:=nullpicture;
        draw dashpattern(on 5bp off 2bp on 5bp off 2bp on 1bp off 2bp );
        picture pf;
        pf=currentpicture;
        currentpicture:=nullpicture;
        draw dashpattern(on 1bp off 2bp on 1bp off 2bp on 5bp off 2bp );
        picture pg;
        pg=currentpicture;
        currentpicture:=nullpicture;
        draw begingraph(6cm,6cm);
        glabel.lft(btex Throughput (bps) etex rotated 90, OUT);
        glabel.bot(btex sources etex, OUT);
        gdraw “thr_olsrmos_20_30_300_0.05_1.txt” withcolor 0.75black dashed pa;
        draw (12, 1)*u–(14, 1)*u withcolor 0.75black dashed pa;
        label.bot(btex T=1 \Delta=0.05 etex scaled 0.5, (13, 1)*u);
        label.top(btex OLSR-MOS: etex scaled 0.5, (13, 2)*u);
        gdraw “thr_olsr_20_30_300.txt” withcolor 0.75red;
        draw (12, 8)*u–(14, 8)*u withcolor 0.75red;
        label.bot(btex OLSR etex scaled 0.5, (13, 8)*u);
        autogrid(grid.bot,grid.lft) withcolor 0.95white;
        frame.llft;
        gdraw “thr_olsrmos_20_30_300_0.05_1.txt” withcolor 0.75black dashed pa;
        draw (12, 1)*u–(14, 1)*u withcolor 0.75black dashed pa;
        label.bot(btex T=1 \Delta=0.05 etex scaled 0.5, (13, 1)*u);
        label.top(btex OLSR-MOS: etex scaled 0.5, (13, 2)*u);
        gdraw “thr_olsr_20_30_300.txt” withcolor 0.75red;
        draw (12, 8)*u–(14, 8)*u withcolor 0.75red;
        label.bot(btex OLSR etex scaled 0.5, (13, 8)*u);
        endgraph;
        endfig;
        end

        `

        [attachment=813]ftt_olsrmos_20_30_300_0.05_1.txt[/attachment]

        [attachment=814]ftt_olsr_20_30_300.txt[/attachment]

        [attachment=815]ftt_olsr_20_30_300_2013-11-12.txt[/attachment]

        I file hanno un nome diverso da quello che scrivi nel documento di esempio; cambio nome e tutto funziona, purché aggiunga [tt]$[/tt] dove serve:
        `btex $T=1$ $\Delta=0.05$ etex`
        Ciao
        Enrico

      • #90284
        Up
        0
        Down
        ::


        Ciao Enrico, che dirti, mi hai salvato, sei un grande, un genio 🙂 P.s.: pura curiosità, dov’era l’errore? E soprattutto, puoi consigliarmi qualche guida in merito?

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

    Go to top