Graphics, Figures & TablesProportions messed up in animation

Information and discussion about graphics, figures & tables in LaTeX documents.
Alrik
Posts: 13
Joined: Wed Aug 05, 2009 9:27 am

Proportions messed up in animation

Post by Alrik »

Hi together,

I'm trying to create an animated Chi-Square Distribution from a static file with ps-tricks and animate, but the proportions are completely messed up in the animated figure. I guess there's some tiny rub in my code I'm too blind by now to find... :?

The static figure:

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage{pst-func}
\usepackage{graphicx} %graphic support

\begin{document}

\psset{xunit=1cm,yunit=7.5cm,plotpoints=200}
\begin{pspicture*}(-0.9,-0.1)(12,.9)
 \rput[t]{0}(4,0.5){$f(x;k) = \frac{1}{2^{k/2}\Gamma(k/2)}x^{k/2-1}e^{-x/2}$}
 \multido{\rnue=0.5+0.5, \iblue=10+10, \rloc=0.6+-0.05}{10}{%
 \psChiIIDist[linewidth=1pt, linecolor=blue!\iblue, nue=\rnue]{0.01}{11}
 \psframe*[linecolor=white,framearc=0.1](8,0.1)(8,0.7)
 \psline[linewidth=1pt, linecolor=blue!\iblue]{-}(8,\rloc)(8.5,\rloc)
 \uput[0](8.7,\rloc){\scriptsize k = \rnue}}
 \psaxes[Dy=0.1, tickstyle=bottom]{->}(0,0)(0,0)(12,.9)
\end{pspicture*}

\end{document}
The animated figure:

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage{pst-func}
\usepackage{graphicx}
\usepackage{animate}

\begin{document}
%-------------------- write timeline file ---------------------%
\newwrite\TimeLineFile
\immediate\openout\TimeLineFile=chi.txt
\immediate\write\TimeLineFile{::0x0}
\multido{\i=1+1}{10}{\immediate\write\TimeLineFile{::\i}}
\immediate\closeout\TimeLineFile
%------------------- assemble animation ------------------------%
\psset{xunit=1cm, yunit=7.5cm, plotpoints=200}
\begin{animateinline}[controls, 
                      buttonsize=1em,
                      timeline=chi.txt,
                      begin={\begin{pspicture}(-0.9,-0.1)(12,.9)},
                      end={\end{pspicture}}]{6}
\psaxes[Dy=0.1, tickstyle=bottom]{->}(0,0)(0,0)(12,.9)
\newframe
\multiframe{10}{rnue=0.5+0.5, iblue=10+10, rloc=0.6+-0.05}{%
\psChiIIDist[linewidth=1pt, linecolor=blue!\iblue, nue=\rnue]{0.01}{11}
\psline[linewidth=1pt, linecolor=blue!\iblue]{-}(8,\rloc)(8.5,\rloc)
\psframe*[linecolor=white,framearc=0.1](8,0.1)(8,0.7)
\uput[0](8.7,\rloc){\scriptsize k = \rnue}}
\end{animateinline}

\end{document}
Thanks for any help,

Alrik

P.S.: I use the output profile LaTeX=>PS=>PDF under Windows Vista with MikTex 2.7 and TeXnic Center 1 Beta 7.50.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

Proportions messed up in animation

Post by CrazyHorse »

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage{pst-func}
\usepackage{graphicx}
\usepackage{animate}
\def\OneShot#1#2#3{%
  \psChiIIDist[linewidth=1pt, linecolor=blue!#2, nue=#1]{0.01}{11}
  \psline[linewidth=1pt, linecolor=blue!#2]{-}(8,#3)(8.5,#3)
  \psframe*[linecolor=white,framearc=0.1](8,0.1)(8,0.7)
  \uput[0](8.7,#3){\scriptsize k=#1}}

\begin{document}
%-------------------- write timeline file ---------------------%
\newwrite\TimeLineFile
\immediate\openout\TimeLineFile=chi.txt
\immediate\write\TimeLineFile{::0x0}
\multido{\i=1+1}{100}{\immediate\write\TimeLineFile{::\i}}
\immediate\closeout\TimeLineFile
%------------------- assemble animation ------------------------%
\psset{xunit=1cm, yunit=7.5cm, plotpoints=200}
\begin{animateinline}[controls,
                      buttonsize=1em,
                      timeline=chi.txt,
                      begin={\begin{pspicture}(-0.9,-0.1)(12,.9)},
                      end={\end{pspicture}}]{6}
\psaxes[Dy=0.1, tickstyle=bottom]{->}(0,0)(0,0)(12,.9)

\newframe
\multiframe{100}{rnue=0.5+0.05, iblue=0+1, rloc=0.6+-0.005}{\OneShot{\rnue}{\iblue}{\rloc}}
\end{animateinline}

\end{document}
I have no problem with this slightly modified example

Herbert
Alrik
Posts: 13
Joined: Wed Aug 05, 2009 9:27 am

Re: Proportions messed up in animation

Post by Alrik »

Hi Herbert,

thank you very much. The problem is not so much the animation itself as the aspect ratio of the figure. I've attached the 2 pdf.files that are produced when I run my code. Notice the messed-up aspect (axes scales) although I use exactly the same coordinate specifications in both figures. The same distortion happened when I ran your code.

Best wishes, Alrik
Attachments
2.pdf
Animated Figure
(65.18 KiB) Downloaded 452 times
1.pdf
Static Figure
(49.69 KiB) Downloaded 369 times
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

Re: Proportions messed up in animation

Post by CrazyHorse »

understood ...
attached my pdf. I suppose a problem in your config.ps and
the paper format. try to find it with

kpsewhich config.ps

and look for the paper descriptions

Herbert
Attachments
test.pdf
(237.59 KiB) Downloaded 395 times
Alrik
Posts: 13
Joined: Wed Aug 05, 2009 9:27 am

Re: Proportions messed up in animation

Post by Alrik »

Hallo Herbert,

thanks again, it works now although all I did after all was to re-install ghostscript...maybe it has automatically re-set the paper size definitions.

Best wishes,

Alrik
jonysatie
Posts: 27
Joined: Fri Apr 06, 2007 1:15 am

Re: Proportions messed up in animation

Post by jonysatie »

Hallo.
I have now the same problem, the proportions are messed up. what can I do?
I didn't understand the solution of crazyHorse.
Alrik
Posts: 13
Joined: Wed Aug 05, 2009 9:27 am

Re: Proportions messed up in animation

Post by Alrik »

Hi jonysatie,

in the end I had the same problem again. My solution now is to simply use LaTeX => PS and open the file with Acrobat Distiller. That works strangely enough. Using LaTeX => PS => PDF won't.
jonysatie
Posts: 27
Joined: Fri Apr 06, 2007 1:15 am

Re: Proportions messed up in animation

Post by jonysatie »

Ok, Thank you. I hope anyone can find a possible solution to this thread in animate package.
Best regards.
alex
Posts: 32
Joined: Mon May 19, 2008 10:53 am

Proportions messed up in animation

Post by alex »

Alrik wrote:Hi jonysatie,

in the end I had the same problem again. My solution now is to simply use LaTeX => PS and open the file with Acrobat Distiller. That works strangely enough. Using LaTeX => PS => PDF won't.
Please, make sure your editor doesn't call DVIPS with option -Ppdf when going the LaTeX => PS => PDF route. See `Bugs' section in the animate documentation for explanation.

Alexander
Alrik
Posts: 13
Joined: Wed Aug 05, 2009 9:27 am

Re: Proportions messed up in animation

Post by Alrik »

Hi alex,

perfect! It works now. Thanks a lot for your help.

Best wishes, Alrik
Post Reply