Diagonale Beschreibungen zur Handlung?

Diagonale Beschreibungen zur Handlung?

Gibt es eine Möglichkeit, die Beschreibungen auf dieser Handlung diagonal zu gestalten, sodass sie lesbar sind?

Bildbeschreibung hier eingeben

Der Code, den ich verwende:

% Data
%----------------------------------------
\pgfplotstableread[row sep=\\,col sep=&]{
    bench   & DCPT & RPT  \\
    twolf   & 0.99 & 1.00 \\
    bzip2s  & 1.00 & 1.00 \\
    swim    & 1.01 & 0.99 \\
    bzip2g  & 1.03 & 1.01 \\
    bzip2p  & 1.04 & 1.01 \\
    art110  & 1.06 & 1.02 \\
    art470  & 1.06 & 1.02 \\
    apsi    & 1.09 & 1.01 \\
    applu   & 1.09 & 1.03 \\
    galgel  & 1.10 & 1.02 \\
    wupwise & 1.25 & 1.08 \\
    ammp    & 1.68 & 1.12 \\
    }\mydata

% Plot
%----------------------------------------
\begin{figure}
\begin{tikzpicture}
    \begin{axis}[
            ybar,
            bar width=.1cm,
            width=\textwidth/2,
            %height=.5\textwidth/1,5,
            legend style={at={(0.5,1)},
                anchor=north,legend columns=-1},
            symbolic x coords={twolf, bzip2s, swim, bzip2g, bzip2p, art110, art470, apsi, applu, galgel, wupwise, ammp},
            xtick=data,
            ymin=.95,ymax=2,
            ylabel={Speedup},
        ]
        \addplot table[x=bench,y=DCPT]{\mydata};
        \addplot table[x=bench,y=RPT]{\mydata};
        %\addplot table[x=interval,y=carR]{\mydata};
        \legend{DCPT, RPT}
    \end{axis}
    \end{tikzpicture}
    \caption{Caption.}
    \label{fig:fig}
\end{figure}

Antwort1

Jemand hat das für mich gelöst, also werde ich es teilen. Durch das Hinzufügen dieses Codes xticklabel style={rotate=90}wurden die Beschriftungen gedreht.

Bildbeschreibung hier eingeben

Antwort2

Nur zur Übung, ändern Sie Ihr Design leicht und verwenden Sie für die symbolischen Koordinaten Daten aus der Tabelle \mydata. Basierend auf DasAntwort:

\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.16}

\pgfplotstableread[row sep=\\,col sep=&]{
    bench   & DCPT & RPT  \\
    twolf   & 0.99 & 1.00 \\
    bzip2s  & 1.00 & 1.00 \\
    swim    & 1.01 & 0.99 \\
    bzip2g  & 1.03 & 1.01 \\
    bzip2p  & 1.04 & 1.01 \\
    art110  & 1.06 & 1.02 \\
    art470  & 1.06 & 1.02 \\
    apsi    & 1.09 & 1.01 \\
    applu   & 1.09 & 1.03 \\
    galgel  & 1.10 & 1.02 \\
    wupwise & 1.25 & 1.08 \\
    ammp    & 1.68 & 1.12 \\
    }\mydata
\begin{document}
    \begin{tikzpicture}
\begin{axis}[x=10mm,
    ybar,
    bar width=3.2mm,
    enlarge x limits=0.1,
    enlarge y limits={.1, upper},
% y ticks style and label
ylabel={Speedup},
    ymin=0, 
% x axis ticks and style
    xtick=data,
    xticklabels from table={\mydata}{bench},    % <-------------------
    table/x expr = \coordindex,                 % <-------------------
    x tick label style = {rotate=45, anchor=east},
% legends and labels
    legend style = {legend columns=-1,
                    at={(0.5,0.98)},
                    anchor=north,
                    /tikz/every even column/.append style={column sep=1em}
                    },
    ]
\addplot [fill=blue!80!black]
            table [y=DCPT]  {\mydata};
            \addlegendentry{DCPT};
\addplot [fill=yellow!80!black]                       
            table [y=RPT]  {\mydata};
            \addlegendentry{RPT};
    \end{axis}
\end{tikzpicture}
\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen