Posicionamiento del eje de pgfplots en tikzpicture

Posicionamiento del eje de pgfplots en tikzpicture

Quiero colocar un gráfico de pgfplots junto a otras imágenes PDF que importo a mi documento, pero no sé cómo colocar los pgfplots axisen el formato más grande 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}

aquí está el resultado de ejemplo: salida de ejemplo

El axisparece comenzar desde el (0,0)de tikzpicture.

Quería ver cómo puedo posicionar este eje después de la segunda imagen. De modo que su esquina inferior izquierda esté encendida (0.66\linewidth,0).

Respuesta1

Puede definir la coordenada para la esquina inferior izquierda de axiscon la attecla,

at={(0.66\linewidth,0)}

Agregue esto a las axisopciones.

ingrese la descripción de la imagen aquí

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

Respuesta2

Como truco rápido, puedes usar un scopecon un adecuado xshifto ponerlo axisdentro de otro 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}

ingrese la descripción de la imagen aquí

Pero será mejor si utiliza otro tikzpictureentorno en mi opinión.

información relacionada