Tikzpicture: Füllfarbe einstellen funktioniert nicht?

Tikzpicture: Füllfarbe einstellen funktioniert nicht?

Ich arbeite mit tikzpicture, um einige Datenpunkte zu plotten. Ich versuche, die Füllfarbe meiner Datenpunkte auf etwas anderes als das Standardblau einzustellen, aber ich sehe nicht, was ich falsch mache. Ich bin sicher, dass ich in der Vergangenheit die Farbe geändert habe, indem ich einfach den fillWert geändert habe, aber in diesem Fall funktioniert es nicht

Ich habe ein MWE angehängt – kann mir jemand dabei helfen:

\documentclass[a4paper]{article} 
\usepackage{amsmath} 
\usepackage{times}
\usepackage{url}
\usepackage{latexsym}
\usepackage{booktabs}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx, subcaption}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{pgfplots, pgfplotstable}    
\usepackage{caption}
\usepackage{rotating}
\usepackage{nicefrac}
\usepackage{subfig}
\usetikzlibrary{spy}
\usepackage{color,colortbl}
\begin{document} 
\begin{figure*}
    \centering
    \begin{tikzpicture}
    \begin{semilogyaxis}[
        nodes near coords,
        ylabel={time [s]},      
        enlargelimits=0.2,
        log basis y=10,
    ]
        \addplot+[
            black,
            fill=red,
            only marks,
            point meta=explicit symbolic,
            visualization depends on=\thisrow{alignment} \as \alignment,            
            every node near coord/.append style={font=\tiny,anchor=\alignment}          
        ] 
        table [
           meta index=2
        ]{
             x         y       label  alignment
             0.4    7.24    C-1               0
             0.5    4.42    C-2               0
        };
    \end{semilogyaxis}
    \end{tikzpicture}
    \caption{Text}
    \label{fig:a1}
\end{figure*}

\end{document}

Antwort1

Sie müssen die mark optionsanstelle der Optionen für die gesamte Achse festlegen. Sie müssen auch nicht sowohl als auch laden pgfplots, pgfplotstableund Sie sollten Ihre Kompatibilitätsversion von pgfplotsmit der compatOption festlegen. Sie laden auchamsmath zweimal. Versuchen Sie in Zukunft,minimalBeispiele, wobei alle Pakete entfernt wurden, die zur Reproduktion des Problems nicht erforderlich waren.

\documentclass[a4paper]{article}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{figure*}
    \centering
    \begin{tikzpicture}
    \begin{semilogyaxis}[
        nodes near coords,
        ylabel={time [s]},
        enlargelimits=0.2,
        log basis y=10,
    ]
        \addplot+[
            black,
            mark options={fill=red},
            only marks,
            point meta=explicit symbolic,
            visualization depends on=\thisrow{alignment} \as \alignment,
            every node near coord/.append style={font=\tiny,anchor=\alignment}
        ]
        table [
           meta index=2
        ]{
             x         y       label  alignment
             0.4    7.24    C-1               0
             0.5    4.42    C-2               0
        };
    \end{semilogyaxis}
    \end{tikzpicture}
    \caption{Text}
    \label{fig:a1}
\end{figure*}

\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen