Re: Le mie (dis)avventure con TikZ

#96736
lorenzo.pantieri
Partecipante
    Up
    0
    Down
    ::


    Ciao a tutti. Come si impone che l’untà di misura sia la stessa su entrambi gli assi? In altre parole, vorrei correggere il codice
    `\begin{tikzpicture}[font=\small]
    \begin{axis} [width=0.39\textwidth,
    axis lines=middle,
    xmin=-2,xmax=4,ymin=-5,ymax=5,
    enlargelimits,
    xtick={-2,-1,1,2,3,4},
    xticklabels={,,,$2$,,},
    ytick={-5,-4,-3,-2,-1,1,2,3,4},
    yticklabels={,$-4$,,,,,,,},
    xlabel=$x$,
    ylabel=$y$]

    \addplot [domain=-10:10, samples=200, restrict y to domain=-30:30,smooth,grafico] {2*x-4};

    \pattern [pattern= north east lines, pattern color=lightgray] (axis cs:2,0) rectangle (axis cs:10,-10);
    \pattern [pattern= north east lines, pattern color=lightgray] (axis cs:2,0) rectangle (axis cs:-10,10);

    % intersezioni
    \draw (axis cs:0,-4) [blue,fill=blue,very thick] circle (2.0pt);
    \draw (axis cs:2,0) [blue,fill=blue,very thick] circle (2.0pt);
    \end{axis}
    \end{tikzpicture}`
    in modo che la tacca sia lunga uguale nei due assi.

    Grazie,
    L.

    Go to top