Errore Pgfplots: Coordinates

  • Creatore
    Topic
  • #91119
    Up
    0
    Down
    ::


    Salve volevo chiedervi un’aiuto nell’uso del pacchetto pgfplots. Volevo realizzare un’istruzione in modo da richiamare attraverso un ciclo “foreach” venti file che ho collocato in una cartella /dati/beta. I file si chiamano “1.dat”, “2.dat”, …, “20.dat”. Il file viene compilato e in output ottengo il file PDF solo che ricevo un’errore che allego alla fine. Inoltre vi volevo chiedere se è possibile realizzare con lo stesso ciclo un’etichettatura del tipo “theta=1°”, “theta=2°”,…, “theta=20°” e realizzare al contempo magari un tratteggio o un colore diverso per ogni curva.
    Codice impostato:
    `\documentclass[12pt,titlepage,oneside]{book}
    \usepackage{pgfplots,pgfplotstable,relsize}

    \pgfplotsset{width=10cm, height=7cm, no markers, scale only axis}
    \pgfplotsset{every axis x label/.append style={ font=\relsize{.1},yshift=-.7em},every axis y label/.append style={font=\relsize{.1},rotate=-90,xshift=-.7em}}
    \pgfkeys{/pgf/number format/.cd,set thousands separator={}}

    \begin{figure}
    \begin{center}
    \begin{tikzpicture}
    \begin{axis}[grid, xlabel={$M_1$ [-]}, ylabel={$\beta$ [\si{\degree}]}]
    \foreach \i in {1,2,3,…,20}
    \addplot table {dati/beta/\i.dat};
    \end{axis}
    \end{tikzpicture}
    \caption{Angolo d'urto in funzione del numero di Mach a monte dell'onda d'urto al variare dell'angolo $\theta$}
    \label{fig:beta}
    \end{center}
    \end{figure}
    `
    Errore:
    `./Main.tex:151: Package pgfplots Error: Could not read table file 'dati/beta/1.
    dat'. In case you intended to provide inline data: maybe TeX screwed up your en
    d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
    pgfplotstable manual for details).

    See the pgfplots package documentation for explanation.
    Type H for immediate help.

    l.151 …ne width=1.2pt] table {dati/beta/\i.dat};

    This error message was generated by an \errmessage
    command, so I can't give any explicit help.
    Pretend that you're Hercule Poirot: Examine all clues,
    and deduce the truth by order and method.

    PGFPlots: reading {dati/beta/1.dat}

    Package pgfplots Warning: the current plot has no coordinates (or all have been
    filtered away) on input line 151.

    [warning /pgfplots/warning/plot without coordinates]

    ./Main.tex:151: Package pgfplots Error: Could not read table file 'dati/beta/2.
    dat'. In case you intended to provide inline data: maybe TeX screwed up your en
    d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
    pgfplotstable manual for details).

    See the pgfplots package documentation for explanation.
    Type H for immediate help.

    l.151 …ne width=1.2pt] table {dati/beta/\i.dat};

    (That was another \errmessage.)

    PGFPlots: reading {dati/beta/2.dat}

    Package pgfplots Warning: the current plot has no coordinates (or all have been
    filtered away) on input line 151.

    [warning /pgfplots/warning/plot without coordinates]

    ./Main.tex:151: Package pgfplots Error: Could not read table file 'dati/beta/3.
    dat'. In case you intended to provide inline data: maybe TeX screwed up your en
    d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
    pgfplotstable manual for details).

    See the pgfplots package documentation for explanation.
    Type H for immediate help.

    l.151 …ne width=1.2pt] table {dati/beta/\i.dat};

    (That was another \errmessage.)

    PGFPlots: reading {dati/beta/3.dat}

    Package pgfplots Warning: the current plot has no coordinates (or all have been
    filtered away) on input line 151.

    [warning /pgfplots/warning/plot without coordinates]

    ./Main.tex:151: Package pgfplots Error: Could not read table file 'dati/beta/4.
    dat'. In case you intended to provide inline data: maybe TeX screwed up your en
    d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
    pgfplotstable manual for details).

    See the pgfplots package documentation for explanation.
    Type H for immediate help.

    l.151 …ne width=1.2pt] table {dati/beta/\i.dat};

    (That was another \errmessage.)

    PGFPlots: reading {dati/beta/4.dat}

    Package pgfplots Warning: the current plot has no coordinates (or all have been
    filtered away) on input line 151.

    [warning /pgfplots/warning/plot without coordinates]

    ./Main.tex:151: Package pgfplots Error: Could not read table file 'dati/beta/5.
    dat'. In case you intended to provide inline data: maybe TeX screwed up your en
    d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
    pgfplotstable manual for details).

    See the pgfplots package documentation for explanation.
    Type H for immediate help.

    l.151 …ne width=1.2pt] table {dati/beta/\i.dat};

    (That was another \errmessage.)

    PGFPlots: reading {dati/beta/5.dat}

    Package pgfplots Warning: the current plot has no coordinates (or all have been
    filtered away) on input line 151.

    [warning /pgfplots/warning/plot without coordinates]

    ./Main.tex:151: Package pgfplots Error: Could not read table file 'dati/beta/6.
    dat'. In case you intended to provide inline data: maybe TeX screwed up your en
    d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
    pgfplotstable manual for details).

    See the pgfplots package documentation for explanation.
    Type H for immediate help.

    l.151 …ne width=1.2pt] table {dati/beta/\i.dat};

    (That was another \errmessage.)

    PGFPlots: reading {dati/beta/6.dat}

    Package pgfplots Warning: the current plot has no coordinates (or all have been
    filtered away) on input line 151.

    [warning /pgfplots/warning/plot without coordinates]

    ./Main.tex:151: Package pgfplots Error: Could not read table file 'dati/beta/7.
    dat'. In case you intended to provide inline data: maybe TeX screwed up your en
    d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
    pgfplotstable manual for details).

    See the pgfplots package documentation for explanation.
    Type H for immediate help.

    l.151 …ne width=1.2pt] table {dati/beta/\i.dat};

    (That was another \errmessage.)

    PGFPlots: reading {dati/beta/7.dat}

    Package pgfplots Warning: the current plot has no coordinates (or all have been
    filtered away) on input line 151.

    [warning /pgfplots/warning/plot without coordinates]

    ./Main.tex:151: Package pgfplots Error: Could not read table file 'dati/beta/8.
    dat'. In case you intended to provide inline data: maybe TeX screwed up your en
    d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
    pgfplotstable manual for details).

    See the pgfplots package documentation for explanation.
    Type H for immediate help.

    l.151 …ne width=1.2pt] table {dati/beta/\i.dat};

    (That was another \errmessage.)

    PGFPlots: reading {dati/beta/8.dat}

    Package pgfplots Warning: the current plot has no coordinates (or all have been
    filtered away) on input line 151.

    [warning /pgfplots/warning/plot without coordinates]

    ./Main.tex:151: Package pgfplots Error: Could not read table file 'dati/beta/9.
    dat'. In case you intended to provide inline data: maybe TeX screwed up your en
    d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
    pgfplotstable manual for details).

    See the pgfplots package documentation for explanation.
    Type H for immediate help.

    l.151 …ne width=1.2pt] table {dati/beta/\i.dat};

    (That was another \errmessage.)

    PGFPlots: reading {dati/beta/9.dat}

    Package pgfplots Warning: the current plot has no coordinates (or all have been
    filtered away) on input line 151.

    [warning /pgfplots/warning/plot without coordinates]
    PGFPlots: reading {dati/beta/10.dat}
    PGFPlots: reading {dati/beta/11.dat}
    PGFPlots: reading {dati/beta/12.dat}
    PGFPlots: reading {dati/beta/13.dat}
    PGFPlots: reading {dati/beta/14.dat}
    PGFPlots: reading {dati/beta/15.dat}
    PGFPlots: reading {dati/beta/16.dat}
    PGFPlots: reading {dati/beta/17.dat}
    PGFPlots: reading {dati/beta/18.dat}
    PGFPlots: reading {dati/beta/19.dat}
    PGFPlots: reading {dati/beta/20.dat}
    LaTeX Font Info: Try loading font information for T1+lmss on input line 154.

    (/usr/local/texlive/2013/texmf-dist/tex/latex/lm/t1lmss.fd
    File: t1lmss.fd 2009/10/30 v1.6 Font defs for Latin Modern
    )
    LaTeX Font Info: External font `lmex10' loaded for size
    (Font) <10.95> on input line 154.
    Package atveryend Info: Empty hook `BeforeClearDocument' on input line 159.
    [1

    {/usr/local/texlive/2013/texmf-var/fonts/map/pdftex/updmap/pdftex.map} <./UNINA .pdf>]

    Package Fancyhdr Warning: \headheight is too small (12.0pt):
    Make it at least 14.49998pt.
    We now make it that large for the rest of the document.
    This may cause the page layout to be inconsistent, however.

    [2]
    Package atveryend Info: Empty hook `AfterLastShipout' on input line 159.
    (./Main.aux)
    Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 159.
    Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 159.

    Package rerunfilecheck Warning: File `Main.out' has changed.
    (rerunfilecheck) Rerun to get outlines right
    (rerunfilecheck) or use package `bookmark'.

    Package rerunfilecheck Info: Checksums for `Main.out':
    (rerunfilecheck) Before:
    (rerunfilecheck) After: D41D8CD98F00B204E9800998ECF8427E;0.

    LaTeX Font Warning: Some font shapes were not available, defaults substituted.

    LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.

    )
    Here is how much of TeX's memory you used:
    36081 strings out of 493308
    792660 string characters out of 6137815
    936016 words of memory out of 5000000
    38816 multiletter control sequences out of 15000+600000
    59242 words of font info for 54 fonts, out of 8000000 for 9000
    957 hyphenation exceptions out of 8191
    63i,11n,74p,10461b,2363s stack positions out of 5000i,500n,10000p,200000b,80000s
    {/usr/local/texlive/2013/texmf-dist/fonts/enc/dvips/lm/lm-mathit.enc}{/usr/lo
    cal/texlive/2013/texmf-dist/fonts/enc/dvips/lm/lm-ec.enc}{/usr/local/texlive/20
    13/texmf-dist/fonts/enc/dvips/lm/lm-mathsy.enc}{/usr/local/texlive/2013/texmf-d
    ist/fonts/enc/dvips/lm/lm-rm.enc}
    Output written on Main.pdf (2 pages, 653970 bytes).
    PDF statistics:
    68 PDF objects out of 1000 (max. 8388607)
    51 compressed objects within 1 object stream
    4 named destinations out of 1000 (max. 500000)
    18 words of extra memory for PDF output out of 10000 (max. 10000000)
    `

    Il grafico che ottengo:

    Buon natale a tutti!!!!!!!

Visualizzazione 15 filoni di risposte
  • Autore
    Risposte
    • #91120
      OldClaudio
      Partecipante
        Up
        0
        Down
        ::


        @pei, non so rispondere alla tua domanda, ma certamente posso dirti che le unità di misura non si indicano fra parentesi quadre.

        Buon Natale

        Claudio

      • #91121
        Up
        0
        Down
        ::


        Provo a darti una risposta. Adatta il seguente codice al tuo caso
        `
        \documentclass{article}

        \usepackage{pgfplots}
        \pgfplotsset{compat=newest}
        \begin{document}
        \begin{tikzpicture}
        \begin{axis}
        \foreach\i in {1,…,20}{
        \edef\mytemp{+[no marks, line width=1.2pt]{x+\i}}
        \expandafter\addplot\mytemp;}
        \end{axis}
        \end{tikzpicture}
        \end{document}
        `
        Se lo compilo ottengo una serie di rette parallele colorate come vuole [tt]pgfplots[/tt] (se infatti scrivi [tt]\addplot+[/tt] non sovrascrive le opzioni di default e anche per questo ho dovuto specificare [tt]no marks[/tt]). Prova a vedere se ti funziona anche con i file [tt].dat[/tt] scrivendo
        `
        \edef\mytemp{+[no marks, line width=1.2pt] table {dati/beta/\i.dat}}
        `
        al posto della mia definizione (non avevo voglia di crearmi dei [tt].dat[/tt] fasulli :D). Dimmi se ti funziona il tutto.

        Il tuo errore avviene perché non viene espansa la macro [tt]\i[/tt] durante la lettura. In questo modo prima espandi la macro e poi [tt]\addplot[/tt] fa quello che deve fare senza trovarsi macro da espandere.

      • #91122
        Up
        0
        Down
        ::


        Non mi funge :(((( mi da sempre lo stesso errore:
        `
        Error: Could not read table file 'dati/beta/1.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).

        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.

        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/2.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).

        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.

        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/3.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).

        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.

        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/4.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).

        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.

        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/5.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).

        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.

        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/6.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).

        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.

        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/7.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).

        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.

        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/8.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).

        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.

        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/9.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).

        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.

        (/usr/local/texlive/2013/texmf-dist/tex/latex/lm/t1lmss.fd
        LaTeX Font Warning: Font shape `T1/lmr/bx/sc' undefined
        (Font) using `T1/lmr/bx/n' instead on input line 106.
        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/1.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).
        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.
        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/2.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).
        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.
        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/3.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).
        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.
        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/4.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).
        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.
        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/5.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).
        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.
        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/6.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).
        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.
        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/7.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).
        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.
        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/8.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).
        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.
        ./Main.tex:150: Package pgfplots Error: Could not read table file 'dati/beta/9.
        dat'. In case you intended to provide inline data: maybe TeX screwed up your en
        d-of-lines? Try `row sep=crcr' and terminate your lines with `\\' (refer to the
        pgfplotstable manual for details).
        See the pgfplots package documentation for explanation.
        Type H for immediate help.

        l.150 \expandafter\addplot\mytemp;}

        Package pgfplots Warning: the current plot has no coordinates (or all have been
        filtered away) on input line 150.
        (/usr/local/texlive/2013/texmf-dist/tex/latex/lm/t1lmss.fd
        ) [1{/usr/local/texli
        ve/2013/texmf-var/fonts/map/pdftex/updmap/pdftex.map} <./UNINA.pdf>]
        Package Fancyhdr Warning: \headheight is too small (12.0pt):
        Make it at least 14.49998pt.
        We now make it that large for the rest of the document.
        This may cause the page layout to be inconsistent, however.
        [2] (./Main.aux)
        LaTeX Font Warning: Some font shapes were not available, defaults substituted.
        )
        (see the transcript file for additional information){/usr/local/texlive/2013/te
        xmf-dist/fonts/enc/dvips/lm/lm-mathit.enc}{/usr/local/texlive/2013/texmf-dist/f
        onts/enc/dvips/lm/lm-ec.enc}{/usr/local/texlive/2013/texmf-dist/fonts/enc/dvips
        /lm/lm-mathsy.enc}{/usr/local/texlive/2013/texmf-dist/fonts/enc/dvips/lm/lm-rm.
        enc}
        Compile aborted.
        Output written on Main.pdf (2 pages, 655408 bytes).
        SyncTeX written on Main.synctex.gz.
        Transcript written on Main.log.
        *** pdflatex.engine has completed.
        `

        il codice:
        `\begin{figure}
        \begin{center}
        \begin{tikzpicture}
        \begin{axis}[grid, xlabel={$M_1$ [-]}, ylabel={$\beta$ [\si{\degree}]}]
        \foreach \i in {1,2,3,…,20} {\edef\mytemp{+[no marks, line width=1.2pt] table {dati/beta/\i.dat}}
        \expandafter\addplot\mytemp;}
        \end{axis}
        \end{tikzpicture}
        \caption{Angolo d'urto in funzione del numero di Mach a monte dell'onda d'urto al variare dell'angolo $\theta$}
        \label{fig:beta}
        \end{center}
        \end{figure}`

        in sostanza tu dice che comunque i dati devono essere prima letti e memorizzati e poi plottati?

      • #91123
        Up
        0
        Down
        ::


        Prova con [tt]\pgfplotsinvokeforeach[/tt], la cui sintassi è leggermente diversa dal classico [tt]foreach[/tt] di TikZ: guarda sul manuale come utilizzarlo.

        Ciao
        Claudio

      • #91124
        Liverpool
        Partecipante
          Up
          0
          Down
          ::


          Io ho provato il tuo codice con tre soli file di dati e non ho ottenuto alcun errore (ovviamente con [tt]\foreach \i in {1,…,3}[/tt]. Tra l’altro, se ho capito bene, le curve vengono disegnate comunque.
          Le etichette si possono aggiungere, ma data la prossimità delle curve, verrebbero una sull’altra a meno che tu non abbia qualche idea che mi sfugge.

          Buon Natale a tutti.

          [attachment=868]test.zip[/attachment]

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


          Ho provato adesso il test di @Liverpool e confermo che anche a me compila correttamente senza errori e senza necessita del mio codice. Per essere sicuri, ci diresti gentilmente quale distribuzione hai installato e se è completa?

        • #91126
          Liverpool
          Partecipante
            Up
            0
            Down
            ::


            Ho visto ora che i file che danno problemi sono i primi 9. Sei sicuro che non si chiamino 01.dat ecc…?

          • #91127
            Up
            0
            Down
            ::


            ragazzi io ho installato la teXlive intel 64 per Mac OSX. Il texeditor è il TeXnicle. Comunque ho controllato anche i file non sono “01.dat”, il loro nome è “1.dat”. Comunque in parte ho risolto creando con Matlab un’unico file e richiamandomi tutte le colonne in questo modo credo che la soluzione è abbastanza decente:
            `\begin{figure}
            \begin{center}
            \begin{tikzpicture}
            \begin{axis}[grid, xlabel={$M_1$ [-]}, ylabel={$\beta$ [\si{\degree}]}]
            \foreach \i in {1,2,3,…,20} {
            \edef\mytemp{+[no marks, line width=1.1pt] table[x index=0,y index=\i]{dati/beta.dat}}
            \expandafter\addplot\mytemp;}
            end{axis}
            \end{tikzpicture}
            \caption{Angolo d'urto in funzione del numero di Mach a monte dell'onda d'urto al variare dell'angolo $\theta$}
            \label{fig:beta}
            \end{center}
            \end{figure}`
            e anche il risultato non è male credo :P:


            Vi volevo chiedere un’ultima cosa io sto seguendo la guida a pgfplots fatta dal mio docente Agostino De Marco e c’è una sezione in cui si parla di un’etichettatura semi-automatica dichiarando all’inizio una pgfkeys e poi richiamandolo come opzione di addplot secondo voi è possibile richiamare questa funzione per creare delle etichette in modo automatico. E anche se è possibile implementare più colori differenti per le curve.

          • #91128
            Liverpool
            Partecipante
              Up
              0
              Down
              ::


              Per cambiare lo stile delle linee (compreso colore e tratto) devi definirti una tua [tt]cycle list[/tt], oppure usarne un’altra predefinita. Leggi il par. 4.7.7 della documentazione e soprattutto gli esempi di codice a pag. 174 che spiegano come si realizza una lista.
              Per le etichette automatiche si può fare, ma non ho capito bene cosa vuoi fare. Dove vorresti metterle?

              Il tuo docente, che è anche un utente del forum, ne capisce parecchio di [tt]pgfplots[/tt]… e non solo.

              Ciao

            • #91129
              OldClaudio
              Partecipante
                Up
                0
                Down
                ::


                Il diagramma non mi spiace, ma le unità di misura fra parentesi quadre sono un errore palese, commesso dai più; se è un errore, non è un buon motovo di commetterlo con la scusa che tutti scrivono così.

                Quasi tutti scrivono mt non per indicare le millitonnellata(cioè i chili) ma per scrivere metri; lo stesso mq per non dire milliquintali; lo stesso per Km per non dire kelvinmetri; e via di questo passo.
                Ho già scritto abbastanza sull’analfabetismo metrologico; quindi non insisto; ma se chiedi al tuo docente vedrai che conferma quanto dico; per una cosa più autorevole scarica dal sito dal sito NIST (National Institute of Science and Technology, l’ex National Bureau of Standards statunitense) il documento sp811.pdf e, tolti i pochi commi che si riferiscono espressamente alla lingua inglese, avrai la conferma di quel che dico. Non parliamo poi della parentesi quadre che contengono solo la lineeta per il numero di Mach adimensionato 😯

                Nel tuo diagramma invece di scrivere β [°] sull’asse delle ordinate scrivi esplicitamente “Angolo di attacco β n gradi’ magari ruotando la scritta di 90° in senso antiorario, e in Ascisse scrivi “Numero di Mach M” (ovviamente senza le virgolette) e, se lo ritieni opportuno, semplifica la didascalia corrispondentemente.

                Quello che ti ho suggerito per l’etichettatura degli assi è quanto prescrive la norma UNI sul disegno tecnico. Non mi sono inventato niente e non ti sto importunando con mie fisime particolari. Sì, certo, ce l’ho un po’ con coloro che usano informazioni metriche ma non le sanno scrivere; lo ammetto, ma non credo che sia opportuno lasciar correre, come chiunque non lascerebbe correre se si scrivesse squola invece di scuola.:wink:

              • #91130
                Up
                0
                Down
                ::


                i tuoi suggerimenti sono stati preziosissimi, infatti non so come ringraziarti specie per il documento della NIST è un piccolo manualetto da tenere ben aperto insieme ad ArteLaTex quando si lavora specie in questo ambiente. Devo ammettere la mia palese ignoranza in questo ambito in quanto nè alle superiore nè all’università nessun ci dice come “compilare” correttamente un rapporto tecnico e farlo come si deve. Grazie ancora!!!!

              • #91131
                Up
                0
                Down
                ::


                una domanda sono riuscito a realizzare sempre nello stesso ciclo foreach la creazione di una legenda solo che dato il numero di curve esce fuori dall’immagine. Volevo un consiglio su come poter indicare queste curve che sono ad un angolo differente. Cioè in questi casi come si etichettano le curve data la mole?

              • #91132
                Up
                0
                Down
                ::


                La legenda non mi sembra una cattiva idea. Magari potresti diminuire il carattere con i comandi opportuni, collocandola in alto a destra (dove immagino tu l’hai già collocata :D).

              • #91133
                OldClaudio
                Partecipante
                  Up
                  0
                  Down
                  ::

                  pepi_b” post=90708i tuoi suggerimenti sono stati preziosissimi, infatti non so come ringraziarti specie per il documento della NIST è un piccolo manualetto da tenere ben aperto insieme ad ArteLaTex quando si lavora specie in questo ambiente. Devo ammettere la mia palese ignoranza in questo ambito in quanto nè alle superiore nè all’università nessun ci dice come “compilare” correttamente un rapporto tecnico e farlo come si deve. Grazie ancora!!!!

                  Nella sezione Documentazione di questo sito c’è un piccola guida Saper Comunicare che il Politecnico di Torino ha messo a disposizione dei suoi studenti e degli studenti di qualunque università; credo che sia una copia di due o tre anni fa. Recentemente Ne è stata prdisposta una versine più recente ed conforme alla situazione dei nuovi Stautti sia del PoliTO, sia di altre università dove spesso le facoltà non esistono più.

                  Ma per quel che riguarda la scrittura delel tesi o di una qualsiasi rapporto tecnico le cose sono ben ferme e non credo che verranno cambiate dalla attuale Commissione Rettorale che dovrebbe provvedere ad una revisione della revisione. Lo faranno certamente, ma chissà quando; nel frattempo hanno promesso che in via porvvisoria metteranno la versione attuale nel sito della Didattica del Polito.
                  Se e quando avverrà, verrà aggiornata anche la versione scaricabile dal sito del GuIT.

                  Ti suggerisco di scaricarla da questo sito e di leggerla. Non occorre uno studio approfondito, e quell’ottantina di pagine contengono anche molte tabelle, quindi quello che c’è da leggere dovrebbe essere ben distinto dalle indicazioni burocratiche che per altro quella piccola guida contiene.

                • #91134
                  Up
                  0
                  Down
                  ::


                  Grazie ad @OldClaudio per la guida utilissima!!

                  Secondo voi è accettabile, credo che è questo è l’unico modo di poter etichettare le varie curve:

                  Ho seguito la guida sapercomunicare che suggerisce di non sfruttare troppo il colore specie per stampe che saranno certamente in bianco e nero

                • #91135
                  Liverpool
                  Partecipante
                    Up
                    0
                    Down
                    ::

                    pepi_b” post=90716Grazie ad @OldClaudio per la guida utilissima!!

                    Secondo voi è accettabile, credo che è questo è l’unico modo di poter etichettare le varie curve:
                    Ho seguito la guida sapercomunicare che suggerisce di non sfruttare troppo il colore specie per stampe che saranno certamente in bianco e nero

                    Secondo me, se devi stampare in bianco e nero, non ha senso usare i tratteggi perché ci sono più curve con lo stesso stile di linea. Se ho capito bene l’andamento del grafico, io scriverei semplicemente nella didascalia “al variare dell’angolo \(\theta\) dal valore di 1° (curva più in basso) a 20° (curva più in alto).” e credo che chiunque capirebbe che all’aumentare dell’angolo le curve si “alzano”. Al massimo, se è necessario il bianco e nero, ogni 5 curve ne farei una tratteggiata per aiutare a contarle e, in prossimità di queste curve, si potrebbe aggiungere un’etichetta, perciò ti servirebbero solo tre etichette e ci sarebbe lo spazio sufficiente. In letteratura, ho visto anche usare una freccia che taglia la famiglia di curve dal basso verso l’alto obliquamente per far capire in che verso aumenta l’angolo, ma non so quanto sia professionale.

                    Ciao

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

                Go to top