0

As the title suggests, I would like to know if there is a "universal" method to position the label of the ordinate axis horizontally to its left and vertically to its center. In other words, place the label where "Here" is written (added through photo editing)

enter image description here

This is the original code

\begin{tikzpicture}
    \begin{axis}[
            legend pos=outer north east,
            legend cell align={left},
            grid, grid style=dashed,
            ymin=5,ymax=26,
            ytick={10,15,20,25},
            xtick={30,60,90,120,150},
            extra y ticks={5},            % <---
            xmax=180,xmin=0,
            extra x ticks={0},            % <---
            axis lines = middle,
            set layers,                   % <---
            x label style={at={(1,0)},right},  
            x tick label style={/pgf/number format/.cd,
                fixed relative,
            },
            xlabel={$t$ (\unit{\min})},ylabel={$X$(\%)}, 
            style={thick}
        ]  
        \addplot[
            domain = 10:150,
            samples = 200,
            smooth,
            thick,
            verde,
        ]
        {-0.000626382144*x^2+0.237470377288*x+3.475363466567};
        \addlegendentry{\textit{p}-cresolo};
                                    
        \addplot[mark=*,scatter,only marks]
        coordinates {
            (10,6.01) (30,9.74) (60,15.78) (90,18.71) (120,24.29) (150,24.49)
        };
    \end{axis}  
\end{tikzpicture}

2 Answers 2

3
\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=0, xmax=1,
ymin=0, ymax=1,
ylabel={Here},
y label style={rotate=-90, at={(ticklabel cs:0.5)}, font=\Huge},
]
\end{axis}
\end{tikzpicture}
\end{document}

Graph with huge y label

You can also use (axis description cs:-0.1,0.5) or (yticklabel cs:0.5) or (yticklabel* cs:0.5, 20pt) - dependent on exactly how you want to align the label.

0

Try this code (partial...):

\documentclass[tikz, border=1cm]{standalone}

\begin{document}
\begin{tikzpicture}[scale=.3]
    \draw[gray!10] (-1,-1) grid (10,10);
    \draw[line width=1pt,-latex] (-1,0)--(10,0) node[pos=.9,yshift=-12pt] () {\tiny \bfseries $Time$};
    
     \draw[line width=1pt,-latex] (0,-1)--(0,10) node[magenta,pos=.5,xshift=-20pt] () {\tiny \bfseries $Space$};
    \foreach \i in {1,2,...,10}{%
        \draw (\i,.1)--(\i,-.1) node[below] () {\tiny \i};
        \draw (.1,\i)--(-.1,\i) node[left] () {\tiny \i};
    }
\end{tikzpicture}
\end{document}

Output:

enter image description here

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.