0

I am having difficulty using Dataplot for a beamer document. My code works for an article document class. I have an examples below. I am compiling with XeLaTeX. Any help would be great. Thanks!


This code does not generate the data line...

\documentclass{beamer}
\usepackage{pst-plot}

\begin{document}

\begin{frame}


\begin{figure}
\begin{center}
\psset{unit=7cm}
\begin{pspicture}(-.1,-.1)(1.1,.8)
\psaxes(0,0)(1,.7)
\psline(0,.7)(1,.7)(1,0)
\psline(0,0)(1,.7)
\psline(.3,0)(1,.7)
\psline[linestyle=dotted](.5,0)(.5,.7)
\savedata{\mydata}[
{{0.00, 0.00000},  {0.01, 0.00629}, {0.02,   0.01258}, {0.03,   0.01887}, {0.04,   0.02515}, {0.05,   0.03144}, {0.06,   0.03773}, {0.07,   0.04402}, {0.08,   0.05031}, {0.09,   0.05660},
 {0.10,   0.06288}, {0.11,   0.06917}, {0.12,   0.07546}, {0.13,   0.08175}, {0.14,   0.08804}, {0.15, 0.09433}, {0.16,   0.10061}, {0.17,   0.10690}, {0.18,   0.11319}, {0.19,   0.11948}, 
 {0.20,   0.12577}, {0.21,   0.13206}, {0.22,   0.13834}, {0.23,   0.14463}, {0.24,   0.15092}, {0.25,   0.15721}, {0.26,   0.16350}, {0.27,   0.16979}, {0.28,   0.17607}, {0.29,   0.18236}, 
 {0.30, 0.18865}, {0.31,   0.19494}, {0.32,   0.20123}, {0.33,   0.20752}, {0.34,   0.21380}, {0.35,   0.22009}, {0.36,   0.22638}, {0.37,   0.23267}, {0.38,   0.23896}, {0.39,   0.24525}, 
 {0.40,   0.25153}, {0.41,   0.25782}, {0.42,   0.26411}, {0.43,   0.27040}, {0.44,   0.27669}, {0.45,0.28298}, {0.46,   0.28926}, {0.47,   0.29555}, {0.48,   0.30184}, {0.49,   0.30813}, 
 {0.50,   0.31442}, {0.51,   0.32080}, {0.52,   0.32734}, {0.53,   0.33403}, {0.54,   0.34084}, {0.55,   0.34777}, {0.56,   0.35480}, {0.57,   0.36192}, {0.58,   0.36912}, {0.59,   0.37640}, 
 {0.60,0.38374}, {0.61,   0.39114}, {0.62,   0.39860}, {0.63,   0.40610}, {0.64,   0.41366}, {0.65,   0.42125}, {0.66,   0.42889}, {0.67,   0.43655}, {0.68,   0.44426}, {0.69,   0.45199}, 
 {0.70,   0.45975}, {0.71,   0.46754}, {0.72,   0.47535}, {0.73,   0.48319}, {0.74,   0.49105}, {0.75,0.49893}, {0.76,   0.50683}, {0.77,   0.51474}, {0.78,   0.52267}, {0.79,   0.53062}, 
 {0.80,   0.53858}, {0.81,   0.54656}, {0.82,   0.55455}, {0.83,   0.56255}, {0.84,   0.57056}, {0.85,   0.57859}, {0.86,   0.58663}, {0.87,   0.59467}, {0.88,   0.60273}, {0.89,   0.61079}, 
 {0.90,0.61887}, {0.91,   0.62695}, {0.92,   0.63504}, {0.93,   0.64313}, {0.94,   0.65124}, {0.95,   0.65935}, {0.96,   0.66747}, {0.97,   0.67559}, {0.98,   0.68372}, {0.99,   0.69186}, 
 {1.00,   0.70000}}]
\dataplot[plotstyle=curve,showpoints=false,linecolor=blue,linewidth=1.5pt]{\mydata}
\end{pspicture}
\end{center}
\end{figure}


\end{frame}


\end{document}

This code does generate the line...

\documentclass{article}
\usepackage{pst-plot}

\begin{document}



\begin{figure}
\begin{center}
\psset{unit=7cm}
\begin{pspicture}(-.1,-.1)(1.1,.8)
\psaxes(0,0)(1,.7)
\psline(0,.7)(1,.7)(1,0)
\psline(0,0)(1,.7)
\psline(.3,0)(1,.7)
\psline[linestyle=dotted](.5,0)(.5,.7)
\savedata{\mydata}[
{{0.00, 0.00000},  {0.01, 0.00629}, {0.02,   0.01258}, {0.03,   0.01887}, {0.04,   0.02515}, {0.05,   0.03144}, {0.06,   0.03773}, {0.07,   0.04402}, {0.08,   0.05031}, {0.09,   0.05660},
 {0.10,   0.06288}, {0.11,   0.06917}, {0.12,   0.07546}, {0.13,   0.08175}, {0.14,   0.08804}, {0.15, 0.09433}, {0.16,   0.10061}, {0.17,   0.10690}, {0.18,   0.11319}, {0.19,   0.11948}, 
 {0.20,   0.12577}, {0.21,   0.13206}, {0.22,   0.13834}, {0.23,   0.14463}, {0.24,   0.15092}, {0.25,   0.15721}, {0.26,   0.16350}, {0.27,   0.16979}, {0.28,   0.17607}, {0.29,   0.18236}, 
 {0.30, 0.18865}, {0.31,   0.19494}, {0.32,   0.20123}, {0.33,   0.20752}, {0.34,   0.21380}, {0.35,   0.22009}, {0.36,   0.22638}, {0.37,   0.23267}, {0.38,   0.23896}, {0.39,   0.24525}, 
 {0.40,   0.25153}, {0.41,   0.25782}, {0.42,   0.26411}, {0.43,   0.27040}, {0.44,   0.27669}, {0.45,0.28298}, {0.46,   0.28926}, {0.47,   0.29555}, {0.48,   0.30184}, {0.49,   0.30813}, 
 {0.50,   0.31442}, {0.51,   0.32080}, {0.52,   0.32734}, {0.53,   0.33403}, {0.54,   0.34084}, {0.55,   0.34777}, {0.56,   0.35480}, {0.57,   0.36192}, {0.58,   0.36912}, {0.59,   0.37640}, 
 {0.60,0.38374}, {0.61,   0.39114}, {0.62,   0.39860}, {0.63,   0.40610}, {0.64,   0.41366}, {0.65,   0.42125}, {0.66,   0.42889}, {0.67,   0.43655}, {0.68,   0.44426}, {0.69,   0.45199}, 
 {0.70,   0.45975}, {0.71,   0.46754}, {0.72,   0.47535}, {0.73,   0.48319}, {0.74,   0.49105}, {0.75,0.49893}, {0.76,   0.50683}, {0.77,   0.51474}, {0.78,   0.52267}, {0.79,   0.53062}, 
 {0.80,   0.53858}, {0.81,   0.54656}, {0.82,   0.55455}, {0.83,   0.56255}, {0.84,   0.57056}, {0.85,   0.57859}, {0.86,   0.58663}, {0.87,   0.59467}, {0.88,   0.60273}, {0.89,   0.61079}, 
 {0.90,0.61887}, {0.91,   0.62695}, {0.92,   0.63504}, {0.93,   0.64313}, {0.94,   0.65124}, {0.95,   0.65935}, {0.96,   0.66747}, {0.97,   0.67559}, {0.98,   0.68372}, {0.99,   0.69186}, 
 {1.00,   0.70000}}]
\dataplot[plotstyle=curve,showpoints=false,linecolor=blue,linewidth=1.5pt]{\mydata}
\end{pspicture}
\end{center}
\end{figure}




\end{document}
  • 2
    The \pslinelinestyle is not defined for me, but beside this: Try out \begin{frame}[fragile]. – Ulrike Fischer Apr 13 '17 at 10:25
1

The combination of center and figure environment adds additional space, to avoid this use \centering instead. Contrary to document classes which rely on floats, it's not necessarily required to use a figure environment with beamer (if you use one, you don't need \centering, the content is centred by default).

This code compiles fine under pdflatex, if you launch the compiler with the enable-write18 switch (MiKTeX) or -shell-escape (TeX Live, MacTeX):

    \documentclass{beamer}%
    \usepackage[utf8]{inputenc}
    \usepackage{pst-plot}%
   \usepackage{auto-pst-pdf}

\begin{document}

 \savedata{\meindata}[ {{0.00, 0.00000}, {0.01, 0.00629}, {0.02, 0.01258}, {0.03, 0.01887}, {0.04, 0.02515}, {0.05, 0.03144}, {0.06, 0.03773}, {0.07, 0.04402}, {0.08, 0.05031}, {0.09, 0.05660}, {0.10, 0.06288}, {0.11, 0.06917}, {0.12, 0.07546}, {0.13, 0.08175}, {0.14, 0.08804}, {0.15, 0.09433}, {0.16, 0.10061}, {0.17, 0.10690}, {0.18, 0.11319}, {0.19, 0.11948}, {0.20, 0.12577}, {0.21, 0.13206}, {0.22, 0.13834}, {0.23, 0.14463}, {0.24, 0.15092}, {0.25, 0.15721}, {0.26, 0.16350}, {0.27, 0.16979}, {0.28, 0.17607}, {0.29, 0.18236}, {0.30, 0.18865}, {0.31, 0.19494}, {0.32, 0.20123}, {0.33, 0.20752}, {0.34, 0.21380}, {0.35, 0.22009}, {0.36, 0.22638}, {0.37, 0.23267}, {0.38, 0.23896}, {0.39, 0.24525}, {0.40, 0.25153}, {0.41, 0.25782}, {0.42, 0.26411}, {0.43, 0.27040}, {0.44, 0.27669}, {0.45,0.28298}, {0.46, 0.28926}, {0.47, 0.29555}, {0.48, 0.30184}, {0.49, 0.30813}, {0.50, 0.31442}, {0.51, 0.32080}, {0.52, 0.32734}, {0.53, 0.33403}, {0.54, 0.34084}, {0.55, 0.34777}, {0.56, 0.35480}, {0.57, 0.36192}, {0.58, 0.36912}, {0.59, 0.37640}, {0.60,0.38374}, {0.61, 0.39114}, {0.62, 0.39860}, {0.63, 0.40610}, {0.64, 0.41366}, {0.65, 0.42125}, {0.66, 0.42889}, {0.67, 0.43655}, {0.68, 0.44426}, {0.69, 0.45199}, {0.70, 0.45975}, {0.71, 0.46754}, {0.72, 0.47535}, {0.73, 0.48319}, {0.74, 0.49105}, {0.75,0.49893}, {0.76, 0.50683}, {0.77, 0.51474}, {0.78, 0.52267}, {0.79, 0.53062}, {0.80, 0.53858}, {0.81, 0.54656}, {0.82, 0.55455}, {0.83, 0.56255}, {0.84, 0.57056}, {0.85, 0.57859}, {0.86, 0.58663}, {0.87, 0.59467}, {0.88, 0.60273}, {0.89, 0.61079}, {0.90,0.61887}, {0.91, 0.62695}, {0.92, 0.63504}, {0.93, 0.64313}, {0.94, 0.65124}, {0.95, 0.65935}, {0.96, 0.66747}, {0.97, 0.67559}, {0.98, 0.68372}, {0.99, 0.69186}, {1.00, 0.70000}}]

\begin{frame}
\psset{unit=7cm}
\centering
 \begin{pspicture}(-.1,-.1)(1.1,.8)
 \psaxes(0,0)(1,.7) \psline(0,.7)(1,.7)(1,0) \psline(0,0)(1,.7) \psline(.3,0)(1,.7) \psline[linestyle=dotted](.5,.7) \dataplot[plotstyle=curve,showpoints=false,linecolor=blue,linewidth=1.5pt]{\meindata}
 \end{pspicture}
 \end{frame}

    \end{document} 

enter image description here

| improve this answer | |
  • In beamer, figure is redefined to basically just centre the image, no floating is involved. – samcarter_is_at_topanswers.xyz Apr 13 '17 at 10:53
  • @ sam carter: Didn't know that (I don't use beamer very often). Thanks for the information. Anyway, if there's no caption, as seems to be the case,\centering is simpler. – Bernard Apr 13 '17 at 10:56
  • I don't object with you, that \centering is easier in this case. – samcarter_is_at_topanswers.xyz Apr 13 '17 at 11:46
  • I tried to reformulate the first sentence, please feel free to roll back, if you don't like it. – samcarter_is_at_topanswers.xyz Apr 13 '17 at 12:10
  • @samcarter: It's quite fine for me. Thank you for adding these details. I confess my answers may be a bit condensed at times – when I feel tired of repeating the same details… – Bernard Apr 13 '17 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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