Re: Affiancare una figura e una tabella

#97548
lorenzo.pantieri
Partecipante
    Up
    0
    Down
    ::


    Ecco ho provato. Sia con subfig che con una semplice figure.
    `\begin{figure}
    \centering
    \subfloat[][]{
    \begin{tikzpicture}[font=\small]
    \begin{axis} [width=0.7\textwidth,
    axis lines=middle,
    xmin=-5,xmax=5,ymin=0,ymax=16,
    enlargelimits,
    xtick={-4,…,4},
    ytick={0,…,16},
    xlabel=$x$,
    ylabel=$y$]
    \addplot [domain=-4:4, samples=100,smooth,very thick,blue] {2^x};
    \addplot [only marks, samples at={-4,-3,-2,-1,0,1,2,3,4}, blue] {2^x};
    \end{axis}
    \end{tikzpicture}
    }
    \quad
    \subfloat[][]{
    \begin{tabular}{rl}
    \toprule
    $x$ & $y=2^x$ \\
    \midrule
    $-4$ & $2^{-4} = 1/16$ \\
    $-3$ & $2^{-3} = 1/8$ \\
    $-2$ & $2^{-2} = 1/4$ \\
    $-1$ & $2^{-1}= 1/2$ \\
    $0$ & $2^0 = 1$ \\
    $1$ & $2^1 = 2$ \\
    $2$ & $2^2 = 4$ \\
    $3$ & $2^3 = 8$ \\
    $4$ & $2^4 = 16$ \\
    \bottomrule
    \end{tabular}
    }
    \caption{La funzione $y=2^x$.}
    \end{figure}`

    `\begin{figure}
    \centering
    \begin{tikzpicture}[font=\small]
    \begin{axis} [width=0.8\textwidth,
    axis lines=middle,
    xmin=-5,xmax=5,ymin=0,ymax=16,
    enlargelimits,
    xtick={-4,…,4},
    ytick={0,…,16},
    xlabel=$x$,
    ylabel=$y$]
    \addplot [domain=-4:4, samples=100,smooth,very thick,blue] {2^x};
    \addplot [only marks, samples at={-4,-3,-2,-1,0,1,2,3,4}, blue] {2^x};
    \end{axis}
    \end{tikzpicture}
    %
    \quad
    %
    \begin{tabular}{rl}
    \toprule
    $x$ & $y=2^x$ \\
    \midrule
    $-4$ & $2^{-4} = 1/16$ \\
    $-3$ & $2^{-3} = 1/8$ \\
    $-2$ & $2^{-2} = 1/4$ \\
    $-1$ & $2^{-1}= 1/2$ \\
    $0$ & $2^0 = 1$ \\
    $1$ & $2^1 = 2$ \\
    $2$ & $2^2 = 4$ \\
    $3$ & $2^3 = 8$ \\
    $4$ & $2^4 = 16$ \\
    \bottomrule
    \end{tabular}
    \caption{La funzione $y=2^x$.}
    \end{figure}`
    Non capisco: perché l’allineamento viene così sballato? 🙁

    Go to top