You can use the every mark
style; however, due to the way this style is processed, you need to add it to every axis plot post
to make sure all the keys are evaluated appropriately:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{
every axis plot/.append style={line width=0.8pt},
every axis plot post/.append style={
every mark/.append style={line width=1.6pt,draw=green,fill=red}
}
}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot coordinates {(-2,0) (-1,1) (0,0) (1,1) (2,0)};
\end{axis}
\end{tikzpicture}
\end{document}
The result:
![enter image description here](https://i.stack.imgur.com/S855m.png)
Simply saying
\pgfplotsset{
every axis plot/.append style={line width=0.8pt},
every mark/.append style={line width=1.6pt,draw=green,fill=red}
}
in the above example won't have the desired effect.
An example using mark=x
:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{
every axis plot/.append style={line width=0.8pt},
every axis plot post/.append style={
mark=x,
every mark/.append style={line width=1.6pt,draw=red,scale=2}
}
}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot coordinates {(-2,0) (-1,1) (0,0) (1,1) (2,0)};
\end{axis}
\end{tikzpicture}
\end{document}
![enter image description here](https://i.stack.imgur.com/AShUv.png)
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}
![enter image description here](https://i.stack.imgur.com/USSIk.png)
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
I found this non-obvious to find out, but there is a
plot
"type" or whatever the name is, which means, this will work:Or
Or
Make sure to also use "every axis plot" in the \pgfplotsset in order to work properly.