I want to add more datapoints to my X axis, however it seems like the graph is fixed. Is there a way to make it span across two columns?
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\pgfplotsset{
scale only axis,
scaled x ticks=base 10:3,
}
\begin{axis}[
axis y line*=left,
ymin=85, ymax=100,
ymajorgrids = true,
legend style={at={(0.5,-0.10)},
anchor=north,legend columns=-1},
symbolic x coords={3x3\\Filter, Dsmp\\ (1/2),Integer,Dsmp\\ + Int, Dsmp\\ + 3X3,Dsmp\\ + 3X3\\ + Int},
xtick=data,
nodes near coords,
nodes near coords style={anchor=east,rotate=90,inner xsep=5pt},
x tick label style={font=\small,align=center},
ylabel=Accuracy(\%),
]
\addplot[smooth,mark=x,brown]
coordinates{
(3x3\\Filter,98.98)
(Dsmp\\ (1/2),97.62)
(Integer,95.86)
(Dsmp\\ + Int,91.52)
(Dsmp\\ + 3X3,93.26)
(Dsmp\\ + 3X3\\ + Int,90.18)
}; \label{plot_one}
\end{axis}
\begin{axis}[
axis y line*=right,
axis x line=none,
legend style={at={(0.5,-0.20)},
anchor=north,legend columns=-1},
symbolic x coords={3x3\\Filter, Dsmp\\ (1/2),Integer,Dsmp\\ + Int, Dsmp\\ + 3X3,Dsmp\\ + 3X3\\ + Int},
xtick=data,
nodes near coords,
nodes near coords style={anchor=north,rotate=0,inner xsep=3pt},
ymin=0, ymax=100,
ylabel=Frames Per Second (FPS)
]
\addlegendimage{/pgfplots/refstyle=plot_one}\addlegendentry{Accuracy}
\addplot[smooth,mark=*,blue]
coordinates{
(3x3\\Filter,40)
(Dsmp\\ (1/2),30)
(Integer,20)
(Dsmp\\ + Int,15)
(Dsmp\\ + 3X3,10)
(Dsmp\\ + 3X3\\ + Int,5)
}; \addlegendentry{FPS}
\end{axis}
\end{tikzpicture}
\end{document}
Best Answer
It is a little confusing what you actually want to achive and why you overlap to plots, but you can adjust the width of the plot with
width=20cm
and then you have to add the points in yoursymbolic x coords={...}
. Here I added two points AddPoint1 and AddPoint2.In case of standalone class this problem does not occur because it will automatically adjust to the size.
The follwoing will also work in documentclass article:
Forcing the width to certain value without rotating the x axis: