tikzpicture에서 pgfplots 축 위치 지정

tikzpicture에서 pgfplots 축 위치 지정

axis내 문서로 가져온 여러 다른 PDF 이미지 옆에 pgfplots 플롯을 배치하고 싶지만 더 큰 이미지에 pgfplots를 배치하는 방법을 알 수 없습니다 tikzpicture.

\documentclass{article}

\usepackage{graphicx}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}

\begin{document}
\begin{figure*}

  \begin{center}
    \begin{tikzpicture}

       \node[anchor=south west] (img) at (0,0) 
            {\includegraphics[width=0.3\linewidth]{1.pdf}};
       \node[anchor=south west] 
            at (0.01\linewidth,0.01\linewidth) {a};        

       \node[anchor=south west] (img) at (0.33\linewidth,0) 
            {\includegraphics[width=0.3\linewidth]{1.pdf}};
       \node[anchor=south west] 
            at (0.34\linewidth,0.01\linewidth) {b}; 

       \begin{axis}[width=0.45\linewidth, yticklabels={}]
         \addplot [const plot, fill=red] 
                  table [x index=0, y index=1]
                  {hist.txt}
         \closedcycle;  
       \end{axis}

    \end{tikzpicture}
  \end{center}

  \caption{\label{detdemo}An example of my output}
\end{figure*}
\end{document}

예제 출력은 다음과 같습니다. 예제 출력

은 의 axis에서 시작되는 것 같습니다 .(0,0)tikzpicture

두 번째 사진 다음에 이 축을 어떻게 배치할 수 있는지 알고 싶었습니다. 왼쪽 하단 모서리가 켜져 있습니다 (0.66\linewidth,0).

답변1

axis키를 사용하여 왼쪽 하단 모서리의 좌표를 정의할 수 있습니다 at.

at={(0.66\linewidth,0)}

이것을 axis옵션에 추가하세요.

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

\documentclass{article}

\usepackage{graphicx}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}

\begin{document}
\begin{figure*}

  \begin{center}
    \begin{tikzpicture}

       \node[anchor=south west] (img) at (0,0) 
            {\includegraphics[width=0.3\linewidth]{example-image-a}};
       \node[anchor=south west] 
            at (0.01\linewidth,0.01\linewidth) {a};        

       \node[anchor=south west] (img) at (0.33\linewidth,0) 
            {\includegraphics[width=0.3\linewidth]{example-image-b}};
       \node[anchor=south west] 
            at (0.34\linewidth,0.01\linewidth) {b}; 

       \begin{axis}[width=0.45\linewidth, yticklabels={},at={(0.66\linewidth,0)}]
         \addplot [const plot, fill=red] 
                  {x}
         \closedcycle;  
       \end{axis}

    \end{tikzpicture}
  \end{center}

  \caption{\label{detdemo}An example of my output}
\end{figure*}
\end{document}

답변2

scope빠른 해킹으로 a를 적절한 xshift와 함께 사용하거나 axis다른 node.

\documentclass{article}

\usepackage{graphicx}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\usetikzlibrary{positioning}

\begin{document}
\begin{figure*}

  \begin{center}
    \begin{tikzpicture}

       \node[anchor=south west] (img1) at (0,0)
            {\includegraphics[width=0.3\linewidth]{example-image-a}};
       \node[anchor=south west]
            at (0.01\linewidth,0.01\linewidth) {a};

       \node[anchor=south west] (img2) at (0.33\linewidth,0)
            {\includegraphics[width=0.3\linewidth]{example-image-b}};
       \node[anchor=south west]
            at (0.34\linewidth,0.01\linewidth) {b};
       \begin{scope}[xshift=0.66\linewidth] 
       \begin{axis}[width=0.45\linewidth, yticklabels={}]
         \addplot [const plot, fill=red]
                  {x}       %% I changed this change it back
         \closedcycle;
       \end{axis}
       \end{scope}

    \end{tikzpicture}
  \end{center}

  \caption{\label{detdemo}An example of my output comes here}
\end{figure*}
\end{document}

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

그러나 다른 환경 IMO를 사용하면 더 좋을 것입니다 tikzpicture.

관련 정보