I have the following R code to generate a tikzdevice plot:

tikz(file = "plot_CIs.tex", width = 5, height = 5)
par(cex = 0.8)
ggplot(confidence_interval, aes(x = Statistic, y = Values, group = 1)) +
  geom_errorbar(width = 0.1, aes(ymin = Lower_Bound, ymax = Upper_Bound)) +
  geom_point(shape = 21, size = 3, fill = "white") +
  labs(title = title, subtitle = subtitle) +
  theme(plot.title = element_text(hjust = 0.5)) +
  theme(plot.subtitle = element_text(hjust = 0.5))

In latex I then use the following:

%The package tikz is available in pgf


  %Do not try to scale figure in .tex or you loose font size consistency
  %The code to input the plot is extremely simple
  %Captions and Labels can be used since this is a figure environment
  \caption{Sample output from tikzDevice}

Which results in this image (in a latex pdf): tikzout

I receive the following warning when compiling the latex document:

Overfull \hbox (16.35pt too wide)

which according the the log is related to:

Overfull \hbox (16.35pt too wide) in paragraph at lines 12--14

How do I fix this warning? If I were using \includegraphics for my image, I would simply do:


Is there a way to do the same using \input for tikzdevice plots?



1 Answer 1


You could use \resizebox like this:


Untested since you do not provide a minimal and complete example.

Alternatively you could adjust the width argument in the tikz(...) call.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .