You can use
xtick=data,
xticklabels={T0,T1B,T2B,T2A,T1A,T3A,T4A,T3B,T4B},
The code (I commented out the lines width=\pdfw
and height=\pdfh
since the values were not provided in the code):
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
view={0}{90},
%width=\pdfw,
%height=\pdfh,
scale only axis,
xmin=1, xmax=11,
xlabel={Specimen ID},
xtick=data,
xticklabels={T0,T1B,T2B,T2A,T1A,T3A,T4A,T3B,T4B},
xmajorgrids,
ymin=-30, ymax=30,
ylabel={Percentage Difference},
ymajorgrids,
legend style={at={(0.97,0.03)},anchor=south east,nodes=right}]
\addplot[only marks,mark=square*,color=red] plot coordinates{ (2,2.78639981453257) (3,2.31842963017684) (4,1.14947398221063) (5,7.25340115482997) (6,2.98493302062099) (7,3.26884390452601) (8,14.1539557488726) (9,-0.960290460549314) (10,12.0273779126074) };
\addlegendentry{(+) Direction};
\addplot[only marks,mark=diamond*,color=blue] plot coordinates{ (2,1.38095764618068) (3,5.36378212382794) (4,7.89091352246246) (5,-2.71084599057245) (6,-4.93480585024889) (7,-9.94728428423853) (8,17.0552754021373) (9,2.64843195399426) (10,18.7448964435552) };
\addlegendentry{(-) Direction};
\addplot [
color=black,
solid,
line width=1.0pt,
forget plot
]
coordinates{
(1,0)(11,0)
};
\end{axis}
\end{tikzpicture}%
\end{document}
You can use
xtick={1,...,5},
xticklabels={A,B,C,D,E}
in the options of \nextgroupplot
. Change xtick={1...,5},
as you wish. Further don't use \it{...}
as \it
is tex command and it doesn't take an argument. Use \itshape
as I did.
\documentclass[]{article}
\usepackage{pgfplots, alphalph}
\usepgfplotslibrary{groupplots}
\usepackage{filecontents}
\begin{filecontents*}{mydata.dat}
A B
1 3
2 4
3 1
4 7
5 8
\end{filecontents*}
\begin{filecontents*}{mydata2.dat}
C D
1 7
2 5
3 4
4 6
5 7
\end{filecontents*}
\begin{document}
\begin{figure}
\makebox[\textwidth]{%
\begin{tikzpicture}[font=\footnotesize\sffamily]
\begin{groupplot}[
group style={group size=2 by 1, vertical sep=70pt,
ylabels at=edge left
},
view={0}{90},
width=5.2cm,
height=5.2cm,
scale only axis,
scaled ticks = false,
tick label style={/pgf/number format/fixed},
xlabel={x-axis},
ylabel={y-axis},
unbounded coords=jump]
]
\nextgroupplot [title={\itshape Title 1},
xtick={1,...,5},
xticklabels={A,B,C,D,E}]
\addplot[black, thick, mark=o, only marks]
table[x=A,y=B]{mydata.dat};
\addplot[black, mark=x, only marks]
table[x=C,y=D]{mydata2.dat};
\nextgroupplot [title={\itshape Title 2},
xtick={1,...,5},
xticklabels={F,G,H,I,S}]
\addplot[black, thick, mark=o, only marks]
table[x=C,y=D]{mydata2.dat};
\end{groupplot}
\end{tikzpicture}
}
\end{figure}
\end{document}
Generally \nextgroupplot
takes all options that are taken by axis
environment. Hence you can customize all your x axis
parameters here case by case.
Best Answer
You have to rename the already existing tick labels. Therefore you define the position of the ticks (one tick for each data point as seen below or ticks in a certain pattern as seen in the commented line) by
xtick=
and rename their labels byxticklabels=
.