pgfplot colorbar schema con valori variabili [risolto]

  • Creatore
    Topic
  • #114056
    Up
    0
    Down
    ::


    Ciao premetto che sono abbastanza niubbo…
    Il problema è che sto tentando di mettere una colorbar di fianco a un istogramma e fin qua tutto bene il problema è che non riesco ad adattare le dimensioni degli schemi cromatici sui valori indici che mi interessano, in pratica la colorbar me la mette correttamente ma non riesco a rendere le dimensioni dei colori adattati a i valori che ho nello schema

    SOLUZIONE
    `

    \usepackage{pgfplots}
    \pgfplotsset{
    compat=newest,
    every axis/.append style={
    axis line style={<->}, % arrows on the axis
    title style={font=\small\bf},
    label style={font=\small},
    tick label style={font=\footnotesize},
    legend style={font=\small},
    },
    colormap={schemacromatico}{
    color=(Red)
    color=(Orange)
    color=(Yellow)
    color=(Green)
    color=(Blue)
    },
    }

    \begin{document}
    \begin{figure}[h]
    \begin{tikzpicture}
    \begin{axis}
    [
    title={Conservation Index},
    legend style={at={(0.5,0.9)}, anchor=north},
    enlarge x limits=0.5,
    symbolic x coords={Transetto 1,Transetto 3},
    xtick=data,
    nodes near coords,
    every node near coord/.append style={yshift=1,font=\tiny},
    ymajorgrids=true,
    ybar,
    bar width=20pt,
    ymin=0,
    ymax=1,
    ytick={1,0.9,0.7,0.5,0.3,0},
    ylabel={Valore},
    colormap={nonuniform}{
    of colormap={
    schemacromatico,
    target pos={0,0.3,0.5,0.7,0.9,1},
    sample for=const,
    },
    },
    colorbar,
    colormap access=const,
    colorbar style={
    /pgf/number format/precision=0,
    ytick,
    xtick,
    },
    colormap access=const,
    ]
    \addplot+[
    error bars/.cd,
    y dir=both,
    y explicit
    ]
    coordinates {
    (Transetto 1,0.9068)
    (Transetto 3,0.8618)
    };
    \addplot+[
    error bars/.cd,
    y dir=both,
    y explicit
    ]
    coordinates {
    (Transetto 1,0.8926)
    (Transetto 3,0.8079)
    };
    \legend{2010,2016}
    %\draw ({rel axis cs:0,0}|-{axis cs:0,0}) — ({rel axis cs:1,0}|-{axis cs:0,0});
    \end{axis}
    \end{tikzpicture}
    \caption{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
    \label{fig:eiBoo3ah}
    \end{figure}
    \end{document}

    `

  • Devi essere connesso per rispondere a questo topic.

Go to top