3

The alignment of the plot is wrong when I use colorbar, see figure. How can I fix this?

Further I would like to know how I can make the small axis ticks black in stead of gray? Now you can't really see them in all the plots accept the lower right one.

|____|____|____|
0   500  1000 1500

enter image description here

\begin{tikzpicture}

\pgfplotsset{%
  width=4cm,
  height=4cm,
  scale only axis,
  every x tick label/.append style={font=\scriptsize\color{gray!80!black}},
  xmajorgrids,
  xminorgrids,
  every y tick label/.append style={font=\scriptsize\color{gray!80!black}},
  ymajorgrids,
  yminorgrids
}

\begin{groupplot}[
  group style={group size=2 by 2},
  y dir=reverse,
  axis on top
]

\nextgroupplot[
  xmin=0, xmax=1805,
  xticklabels={\empty},
  ymin=0, ymax=1200,
  colorbar right,
  colormap/blackwhite,
]
\addplot graphics [
  xmin=0, 
  xmax=1805, 
  ymin=0,
  ymax=1200
] {scarlett_dx.png};

\nextgroupplot[
  xmin=0, xmax=1805,
  xticklabels={\empty},
  ymin=0, ymax=1200,
  yticklabels={\empty},
  colorbar right,
  colormap/blackwhite
]
\addplot graphics [
  xmin=0, 
  xmax=1805, 
  ymin=0,
  ymax=1200
] {scarlett_ddx.png};

\nextgroupplot[
  xmin=0, xmax=1805,
  ymin=0, ymax=1200,
  colorbar right,
  colormap/blackwhite
]
\addplot graphics [
  xmin=0, 
  xmax=1805, 
  ymin=0,
  ymax=1200
] {scarlett_dy.png};

\nextgroupplot[
  xmin=0, xmax=1805,
  ymin=0, ymax=1200,
  yticklabels={\empty},
  colorbar right,
  colormap/blackwhite
]
\addplot graphics [
  xmin=0, 
  xmax=1805, 
  ymin=0,
  ymax=1200
] {scarlett_ddy.png};

\end{groupplot}
  • It's generally preferred to post full minimal but compilable example documents (starting from \documentclass, with no dependencies on files that aren't available to others). – Jake Mar 31 '13 at 21:52
  • Yes true. Sorry I forgot to add the other .tex stuff from my tikz.tex where I use \input{..}. – WG- Mar 31 '13 at 22:08
3

You can adjust the padding between the plots using the horizontal sep and vertical sep options in the group style.

To adjust the style of the tick marks, use tick style=gray!50:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}

\begin{document}
\begin{tikzpicture}

\pgfplotsset{%
  width=4cm,
  height=4cm,
  scale only axis,
  every x tick label/.append style={font=\scriptsize\color{gray!80!black}},
  xmajorgrids,
  xminorgrids,
  every y tick label/.append style={font=\scriptsize\color{gray!80!black}},
  ymajorgrids,
  yminorgrids
}

\begin{groupplot}[
  group style={
    group size=2 by 2,
    horizontal sep=6em
    },
  y dir=reverse,
  axis on top,
  tick style=gray!50
]

\nextgroupplot[
  xmin=0, xmax=1805,
  xticklabels={\empty},
  ymin=0, ymax=1200,
  colorbar right,
  colormap/blackwhite,
]
\addplot graphics [
  xmin=0, 
  xmax=1805, 
  ymin=0,
  ymax=1200
] {scarlett_dx.png};

\nextgroupplot[
  xmin=0, xmax=1805,
  xticklabels={\empty},
  ymin=0, ymax=1200,
  yticklabels={\empty},
  colorbar right,
  colormap/blackwhite
]
\addplot graphics [
  xmin=0, 
  xmax=1805, 
  ymin=0,
  ymax=1200
] {scarlett_ddx.png};

\nextgroupplot[
  xmin=0, xmax=1805,
  ymin=0, ymax=1200,
  colorbar right,
  colormap/blackwhite
]
\addplot graphics [
  xmin=0, 
  xmax=1805, 
  ymin=0,
  ymax=1200
] {scarlett_dy.png};

\nextgroupplot[
  xmin=0, xmax=1805,
  ymin=0, ymax=1200,
  yticklabels={\empty},
  colorbar right,
  colormap/blackwhite
]
\addplot graphics [
  xmin=0, 
  xmax=1805, 
  ymin=0,
  ymax=1200
] {scarlett_ddy.png};

\end{groupplot}
\end{tikzpicture}
\end{document}

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.