Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
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
add comment

1 Answer

up vote 3 down vote accepted

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.