Tikzpicture: 채우기 색상 설정이 작동하지 않나요?

Tikzpicture: 채우기 색상 설정이 작동하지 않나요?

나는 몇 가지 데이터 포인트를 플롯하기 위해 tikzpicture와 함께 작업하고 있습니다. 내 데이터 포인트의 채우기 색상을 기본 파란색이 아닌 다른 색상으로 설정하려고 하는데 내가 뭘 잘못하고 있는지 알 수 없습니다. 과거에는 값만 변경하여 색상을 변경했다고 확신 fill하지만 이 경우에는 작동하지 않습니다.

MWE를 첨부했습니다. 누군가 도움을 줄 수 있나요?

\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}

답변1

mark options전체 축에 대한 옵션 대신 을 설정해야 합니다 . 또한 pgfplots및 를 모두 로드할 필요는 없으며 옵션 을 사용하여 pgfplotstable의 호환성 버전을 설정해야 합니다 . 또한 두 번로드됩니다 . 앞으로는 꼭 생성해 보세요pgfplotscompatamsmath최소한의문제를 재현하는 데 불필요한 모든 패키지가 제거되었습니다.

\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}

여기에 이미지 설명을 입력하세요

관련 정보