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.

Using pgfplots, externalize an .avi file and using DVI>ps, externalize an .eps file on A4 but I want a figure with width and height of 10cm in letter (10cm x 10cm). How can I make it?

(If you know how to make a figure that be equal the page size.)

this is my code.

\documentclass{report}‎
‎\usepackage{pgfplots}‎
‎\usepgfplotslibrary{external}‎
‎\tikzexternalize{question}‎
‎\setlength{\pdfpagewidth}{15 cm}‎ 
‎\setlength{\pdfpageheight}{15 cm}‎ 
‎\newpage‎
‎\thispagestyle{empty}‎
‎\begin{document}‎
‎\pgfplotsset{width=10cm,height=10cm}‎
‎\begin{tikzpicture}‎
 ‎\begin{axis}[‎
   ‎xlabel={$x$}‎,
   ‎ylabel={\textbf{ $f(x)$‎ }}
   ]
   ‎\addplot {x^2};‎
   ‎\addplot {x^3};‎
 ‎\end{axis}‎
‎\end{tikzpicture}‎
‎\end{document}
share|improve this question
    
do you want to convert an .avi file to .eps? –  percusse Apr 9 '12 at 8:41
    
Will \centering{\resizebox{1\textwidth}{!}{your tikz file}} be useful? You have to include graphicx package for this. –  Harish Kumar Apr 9 '12 at 8:56
    
thanks for your ansewer. –  sayros May 4 '12 at 6:33
    
@HarishKumar Could you post this as an answer (with a little explanation)? –  Joseph Wright May 6 '12 at 8:11
    
@JosephWright: Done and thanks. –  Harish Kumar May 6 '12 at 11:30

1 Answer 1

To resize an image or picture to desired dimensions, you can either use \resizebox from graphicx package or adjustbox from adjustbox package.

The syntax for resizebox is

\resizebox{width}{height}{your tikz file}

If you want to keep the aspect ration the height can be replaced by !.

The full code will be

\usepackage{graphicx}
...
...
...
\begingroup
\centering
{\resizebox{10cm}{10cm}{
\begin{tikzpicture}‎
 ‎\begin{axis}[‎
   ‎xlabel={$x$}‎,
   ‎ylabel={\textbf{ $f(x)$‎ }}
   ]
   ‎\addplot {x^2};‎
   ‎\addplot {x^3};‎
 ‎\end{axis}‎
‎\end{tikzpicture}‎‎}}
\endgroup

But giving both width and height as 10cm may not keep the aspect ratio intact. Hence putting \resizebox{10cm}{!}{... will adjust the height so as to keep the aspect ratio.

The adjustbox may be used as

\usepackage{adjustbox}
...
...
...

\begin{adjustbox}{width=10cm,height=10cm}
  \begin{tikzpicture}
    % ..
  \end{tikzpicture}
\end{adjustbox}
share|improve this answer

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.