내 tikz 그래프의 범례 위치를 이동하는 방법을 알 수 없는 것 같습니다.

내 tikz 그래프의 범례 위치를 이동하는 방법을 알 수 없는 것 같습니다.

오른쪽 상단에서 왼쪽 상단으로 이동하고 싶지만 아무 것도 작동하지 않습니다.

\begin{figure}[H]
\caption{Stress-Strain Curve, Mix C}
\begin{tikzpicture}
\begin{axis}[xlabel=Strain ,ylabel=Stress (psi), width=12cm, height=8cm]
\addplot+[smooth,color=blue,mark=o]coordinates{
(0.000001,  11)
(0.000045,  38)
(0.000123,  85)
(0.000231,  150)
(0.000371,  230)
(0.000535,  321)
(0.000709,  419)
(0.000897,  524)
(0.001094,  632)
(0.001294,  745)
(0.001502,  862)
(0.001713,  981)
(0.001929,  1103)
(0.002146,  1226)
(0.002365,  1351)
(0.002585,  1478)
(0.002806,  1605)
(0.00303,   1733)
(0.003256,  1861)
(0.003408,  1945)

};
\addlegendentry{Specimen C19E-1}

답변1

범례 위치는 다음을 통해 조정할 수 있습니다.

every axis legend/.append style={}.

그래서

    every axis legend/.append style={at={(0.0,1.03)}, anchor=south west}

당신은 다음을 얻습니다:

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

또는

every axis legend/.append style={at={(0.03,0.97)}, anchor=north west}

당신은 다음을 얻습니다:

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

암호:

\documentclass[tikz, border=2pt]{standalone}
\usepackage{pgfplots}

%% if you want to change this globally
%\pgfplotsset{every axis legend/.append style={
%        at={(0.0,1.03)},
%        anchor=south west}}

\begin{document}

\begin{tikzpicture}
\begin{axis}[xlabel=Strain ,ylabel=Stress (psi), width=12cm, height=8cm,
    every axis legend/.append style={
        at={(0.,1.03)},
        anchor=south west}
]
\addplot+[smooth,color=blue,mark=o]coordinates{
(0.000001,  11)
(0.000045,  38)
(0.000123,  85)
(0.000231,  150)
(0.000371,  230)
(0.000535,  321)
(0.000709,  419)
(0.000897,  524)
(0.001094,  632)
(0.001294,  745)
(0.001502,  862)
(0.001713,  981)
(0.001929,  1103)
(0.002146,  1226)
(0.002365,  1351)
(0.002585,  1478)
(0.002806,  1605)
(0.00303,   1733)
(0.003256,  1861)
(0.003408,  1945)

};
\addlegendentry{Specimen C19E-1}
\end{axis}
\end{tikzpicture}
\end{document}

관련 정보