3

I would like to obtain the result that appear on the right (compiling the following MWE) by using title style:

\documentclass{standalone}
    \usepackage{calc}
    \usepackage{tikz}
       \usetikzlibrary{calc,decorations,patterns,shapes.arrows}
    \usepackage{mathtools}
    \usepackage{tikzscale}
    \usepackage{pgfplots}
       \pgfplotsset{compat=newest}
       \usepgfplotslibrary{groupplots,colormaps}pictures

\begin{document}

\begin{tikzpicture}
      \begin{axis}[title=(a),
                   title style={at={(0,1)},
                   anchor=north west,
                   draw=black,fill=white}]
        \addplot[blue] {x};
     \end{axis}
     \begin{axis}[xshift=10cm]
        \node[draw=black,fill=white,anchor=north west] at (rel axis cs:0,1) {$(a)$};
        \addplot[red] {x};
     \end{axis}
   \end{tikzpicture}
\end{document}

A related (if not the same!) answered question is this one and suggests to use title style={at={(0.1,0.8)}}. I'd like to use, instead, something like title style={at={(0,1)},anchor=north west}, but as you can see, the result is not exactly what I want. Thank you

3

The problem is that title style does every axis title/.append style, while in the default title style there is yshift=6pt. Use every axis title/.style={..} instead of title style={..}, that will redefine the style completely.

enter image description here

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}

   \begin{axis}[title=(a),every axis title/.style={below right,at={(0,1)},draw=black,fill=white}]
   \addplot[blue] {x};
   \end{axis}
   \begin{axis}[xshift=10cm]
   \node[draw=black,fill=white,anchor=north west] at (rel axis cs:0,1) {(a)};
   \addplot[red] {x};
   \end{axis}
\end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.