Re: Le mie (dis)avventure con TikZ

#96768
lorenzo.pantieri
Partecipante
    Up
    0
    Down
    ::


    Fantastico!!! Questo è il codice che ho usato per risolvere il problema:
    `\documentclass{article}
    \usepackage{tikz,pgfplots}
    \usetikzlibrary{calc,backgrounds}
    \begin{document}

    \begin{tikzpicture}[font=\small]
    \begin{axis} [width=\textwidth,
    axis lines=middle,
    xmin=-20,xmax=600,ymin=-5000,ymax=4000,
    enlargelimits,
    xtick=\empty,
    ytick=\empty,
    xlabel=$x$,
    ylabel=$y$,grid]

    \begin{pgfonlayer}{background}
    \addplot [domain=100:400, samples=200,smooth,draw=none,fill=blue!50!cyan!20] {-0.1*x*x+60*x-5000} –(axis cs:400,0);
    \end{pgfonlayer}

    \begin{pgfonlayer}{background}
    \addplot [domain=0:100, samples=200,smooth,draw=none,fill=red!50!orange!20] {-0.1*x*x+60*x-5000} — (axis cs:0,0);
    \end{pgfonlayer}

    \addplot [domain=0:400, samples=200,smooth,very thick,blue] {-0.1*x*x+60*x-5000};
    \addplot [domain=400:600, samples=200,smooth,very thick,dashed] {-0.1*x*x+60*x-5000};

    \draw (axis cs:400,-10000) — (axis cs:400,10000);
    \node [below] at (axis cs:400,0) {$400$};

    \node (a1) at (axis cs:550,3500) {Zona di utile};
    \node (b1) at (axis cs:200,-4000) {Zona di perdita};

    \node (a2) at (axis cs:350,2000) {};
    \node (b2) at (axis cs:30,-1500) {};

    \draw [->] (a1.south) — (a2.center);
    \draw [->] (b1.north) — (b2.center);
    \end{axis}
    \end{tikzpicture}
    \end{document}`
    Grazie milla, Claudio, per il tuo preziosissimo aiuto!!! 🙂 🙂 🙂

    Go to top