# Adjusting features of a pgf plot

I have the pgf plots below, where it doesn't appear well. I wish to

1. put closer the "Solving Time(ms)" and y axis,
2. put the font size smaller how should i do it?

There is also a problem for cramping up the number in the right chart, is there a way not to display every number so that the number do not cramping up?

\documentclass[9pt]{sig-alternate}
% GRAPHICS
\usepackage{pgf}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{arrows,automata,positioning}
\begin{document}
\pgfplotsset{
xticklabel={$\mathsf{\pgfmathprintnumber{\tick}}$},
every axis/.append style={
font=\sffamily,
width=6.5cm,
height=4.9cm
}
}
\begin{figure*}[t]
\begin{minipage}{0.5\linewidth}
\centering
\scriptsize
\begin{tikzpicture}[font=\sffamily]
\begin{semilogyaxis}[title=\textbf{ Dataset 1},
legend pos=outer north east,
legend style={draw=none},
xtick={50,100,150,200,250,300,350,400,450,500},
scaled ticks=false,
log ticks with fixed point={1000 sep=},
axis x line=bottom,
axis y line=left,
axis line style=-,
minor tick style={draw=none},
enlargelimits,
ylabel = Solving Time (ms),
xlabel = Service Class Size
]
\legend{$a$,$b$,$c$,$d$,$e$}
\end{semilogyaxis}
\end{tikzpicture}
\end{minipage}
\begin{minipage}{0.5\linewidth}
\centering
\scriptsize
\begin{tikzpicture}[font=\sffamily]
\begin{semilogyaxis}[title=\textbf{ Dataset 2},
legend pos=outer north east,
legend style={draw=none},
xtick={500,1000,1500,2000,2500,3000,3500,4000,4500,5000},
scaled ticks=false,
log ticks with fixed point={1000 sep=},
axis x line=bottom,
axis y line=left,
axis line style=-,
minor tick style={draw=none},
enlargelimits,
ylabel = Solving Time (ms),
xlabel = Service Class Size
]
\legend{$a$,$b$,$c$,$d$,$e$}
\end{semilogyaxis}
\end{tikzpicture}
\end{minipage}
\end{figure*}
\end{document}


-

Here's the output from the code below

I changed a few things, which you'll see I've tagged with % new bit

• I moved \pgfplotsset into the preamble
• I removed some of the surplus packages- pgfplots loads tikz, pgf, and graphicx, so there's no need to load them explicitly
• I removed \scriptsize from each individual picture, and put it in \pgfplotsset so that the changes are global
• I removed textbf from your individual titles and created a style in pgfplotsset in the preamble (this will ease global changes in the future)
• I removed [font=\sffamily] from \begin{tikzpicture}[font=\sffamily] as it is specified globally in the preamble now
• I changed xtick in each of the pictures, to make the labels a little less cluttered
• I moved the ylabel closer to the axis using ylabel shift=-2pt, which requires compat=1.3 or newer
• I added a % after your first \end{minipage}; this is very important as it removes the additional space that a minipage inserts, and removes the Overfull hbox warning that you got

Code

\documentclass[9pt]{sig-alternate}
\usepackage{pgfplots}

\pgfplotsset{
compat=1.3,
xticklabel={$\mathsf{\pgfmathprintnumber{\tick}}$},
every axis/.append style={
font=\sffamily,
label style={font=\scriptsize\sffamily}, % new bit
legend style={font=\scriptsize\sffamily},% new bit
title style={font=\bfseries\sffamily}, % new bit
width=6.5cm,
height=4.9cm,
ylabel shift=-2pt, % new bit
}
}

\begin{document}

\begin{figure*}[t]
\begin{minipage}{0.5\linewidth}
\centering
\begin{tikzpicture}
\begin{semilogyaxis}[title=Dataset 1,
legend pos=outer north east,
legend style={draw=none},
xtick={50,150,...,500}, % new bit
scaled ticks=false,
log ticks with fixed point={1000 sep=},
axis x line=bottom,
axis y line=left,
axis line style=-,
minor tick style={draw=none},
enlargelimits,
ylabel = Solving Time (ms),
xlabel = Service Class Size
]
\legend{$a$,$b$,$c$,$d$,$e$}
\end{semilogyaxis}
\end{tikzpicture}
\end{minipage}% new bit
\begin{minipage}{0.5\linewidth}
\centering
\begin{tikzpicture}
\begin{semilogyaxis}[title=Dataset 2,
legend pos=outer north east,
legend style={draw=none},
xtick={500,1500,...,4500}, % new bit
scaled ticks=false,
log ticks with fixed point={1000 sep=},
axis x line=bottom,
axis y line=left,
axis line style=-,
minor tick style={draw=none},
enlargelimits,
ylabel = Solving Time (ms),
xlabel = Service Class Size
]
\legend{$a$,$b$,$c$,$d$,$e$}
\end{semilogyaxis}
\end{tikzpicture}
\end{minipage}
\end{figure*}
\end{document}


As a final comment- there are a lot of features that common to both plots, such as

            scaled ticks=false,
log ticks with fixed point={1000 sep=},
axis x line=bottom,
axis y line=left,
axis line style=-,
minor tick style={draw=none},
enlargelimits,


If these are true in every single plot that you draw in this document, then you might like to consider putting these into your global pgfplotsset as well.

In general, try and use styles where ever possible- it eases both code readability and global changes, and is one of the many reasons to use tikz :)

-
+1 yticklabels are still in serif fonts. Four digit numbers shouldn't have a thousand separator. –  Luigi Nov 24 '12 at 19:48