I have a set of tick that are too close to each other and I would like to customize the total length of individual ticks amongst this set. The customization would be applicable for variable legnth and more than two different ticks. See picture below.
The outcome that I would wish to is as following:
I have seen a couple of questions and answers regarding accessing individual ticks by using xshift={\ticknum == <the tick number to access> ? "<value to be applied>" : <else statement>}
when it comes to label positions (Ref: Individual tick label style depending on position). Though, when it comes to tick customization, several posts tackled by using the different types of tick (extra, ...) (Ref: Positioning Even or Odd x axis tick labels in PGFPlots) but that sort of limits to two different types of customization.
This works pretty fine for xshift, yshift and I guess it works for even more in the tick label style
level .. Though, when I try to use the same principle in the tick style
level, I get error messages that it cannot be recognized, as in the example below:
For the error message, that is the given message: The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.
There was one post that work around (Ref: Individual Tick style for each Tick ) by creating different \begin{axis} ... \end{axis}
. Though, it does not seem right :))
I wonder if there is anyway to access the individual ticks within the same \begin{axis} ... \end{axis}
.
[EDIT] For reference, below a base code.
\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
ymajorgrids=true, xmajorgrids=true, grid style=dashed,
xmin=0,
xmax=3,
ymin=0,
ymax=3.2,
ytick={0,1,2,3},
extra y ticks = {0.436, 1.251, 1.436, 2.436, 2.844},
extra y tick labels = {$\overline{G_1}$, $\overline{G_2}$, $\overline{G_3}$, $\overline{G_4}$, $\overline{G}$},
extra y tick style={
y tick label style={
%xshift={\ticknum == 2 ? "20pt" : (\ticknum == 4 ? "-5pt" : "0pt")},
%yshift={\ticknum == 2 ? "+7pt" : ("0pt")},
},
%major tick length = 0.45cm,
%xshift = -0.25cm,
%major tick length={\ticknum == 3 ? "0.45cm" : ("0.15cm")}
},
ylabel = {$\overline{v(t)}$}
]
\addplot[no marks,samples=250, thick] {x};
\end{axis}
\end{tikzpicture}
\end{document}
Thank you,