两个问题:1)如何依赖 pgfplots 上的两个点 2)Pgfplots 在我的投影仪上不起作用

两个问题:1)如何依赖 pgfplots 上的两个点 2)Pgfplots 在我的投影仪上不起作用

这是我的第一台投影机,请多包涵。

{\documentclass{beamer}
\usepackage[frenchb]{babel}
\usepackage[utf8]{inputenc}
\usetheme{CambridgeUS}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{chronology}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes}
\usepackage{pgfplots}

\title[La MM sous l'algèbre des relations]{La morphologie mathématique sous l'algèbre des relations}
\subtitle{Exposé oral de stage}
\author{Mathieu Alain}
\institute{Université Laval}
\newcommand{\RelView}{\textsc{RelView}}

%%%%%%%%%%%% GRAPHIQUE

\newcommand{\cellsize}{0.30}
\newcommand{\circlesize}{0.20}

\newcommand{\cellsizea}{0.45}
\newcommand{\circlesizea}{0.3}

\newcommand{\printwhitecell}[2][]{\node[draw=darkgray, semithick, fill=white, minimum width=\cellsize cm, minimum height=\cellsize cm] at #2 {#1};} 
\newcommand{\printblackcell}[1]{\node[draw=darkgray, semithick, fill=black, minimum width=\cellsize cm, minimum height=\cellsize cm] at #1 {};} 

\newcommand{\printwhitecella}[2][]{\node[draw=darkgray, semithick, fill=white, minimum width=\cellsizea cm, minimum height=\cellsizea cm] at #2 {#1};} 
\newcommand{\printblackcella}[1]{\node[draw=darkgray, semithick, fill=black, minimum width=\cellsizea cm, minimum height=\cellsizea cm] at #1 {};} 


\newcommand{\printcircle}[1]{\draw[gray, semithick, fill=gray] #1 circle (\circlesize cm/2);} 
\newcommand{\printcell}[2]{%
    \if#1w%
        \printwhitecell{#2}%
    \else%
        \if#1b%
            \printblackcell{#2}%
        \else%
            \if#1c%
                \printwhitecell{#2}%
                \printcircle{#2}%
            \else%
                \if#1C%
                    \printblackcell{#2}%
                    \printcircle{#2}%
                \else
                    \printwhitecell[#1]{#2}%
                \fi%
            \fi%
        \fi%
    \fi%

}
\newcommand{\printcella}[2]{%
    \if#1w%
        \printwhitecella{#2}%
    \else%
        \if#1b%
            \printblackcella{#2}%
        \else%
            \if#1c%
                \printwhitecella{#2}%
                \printcirclea{#2}%
            \else%
                \if#1C%
                    \printblackcella{#2}%
                    \printcirclea{#2}%
                \else
                    \printwhitecella[#1]{#2}%
                \fi%
            \fi%
        \fi%
    \fi%

}


\newcommand{\printmatrix}[2]{
    \begin{tikzpicture}
    \foreach \line[count=\i] in #2 {
        \foreach \cell[count=\j] in \line {
            \printcell{\cell}{(\j*\cellsize,-\i*\cellsize)}
        }
        \xdef\width{\j}
    }
    \node at ({0.5*(\width+1)*\cellsize}, {(-\i -1)*\cellsize}) {#1};
    \end{tikzpicture}   
}

\newcommand{\printmatrixa}[2]{
    \begin{tikzpicture}
    \foreach \line[count=\i] in #2 {
        \foreach \cell[count=\j] in \line {
            \printcella{\cell}{(\j*\cellsizea,-\i*\cellsizea)}
        }
        \xdef\width{\j}
    }
    \node at ({0.5*(\width+1)*\cellsizea}, {(-\i -1)*\cellsizea}) {#1};
    \end{tikzpicture}   
}

%%%%%%%%%%%%%%%%%%%%%%


\begin{document}
%PAGE TITRE
    \begin{frame}
    \maketitle
    \end{frame}



%PAGE INTRO 
    \begin{frame}   
    \frametitle{Introduction}
    \pause
    \begin{itemize}
    \item {Connaissance théorique}
    \pause
    \item {Connaissance logiciels}
    \pause
    \item {Aptitudes}
    \end{itemize}
    \end{frame}


%PAGE TDM
    \begin{frame}
    \tableofcontents
    \end{frame}


%SECTION INTRO AUX CONCEPTS
\section{Une introduction aux concepts}

\subsection{Morphologie mathématique}
    \begin{frame}
    \frametitle{Qu'est-ce que la morphologie mathématique?}

    \begin{itemize}
    \item Plusieurs opérateurs, dilatation, érosion, ouverture et fermeture.
    \item Algèbre + Topologie + Treillis = Morphologie Mathématique!
    \end{itemize}   

    \begin{figure}
    \centering
    \begin{subfigure}[b]{0.18\textwidth}
    \caption{Smatou}
    \includegraphics[scale=0.25]{Smatou_mathematica.png}
    \end{subfigure}
    ~
    \begin{subfigure}[b]{0.18\textwidth}
    \caption{Dilatation}
    \includegraphics[scale=0.25]{Smatou_dilatation_mathematica.png}
    \end{subfigure}
    ~
    \begin{subfigure}[b]{0.18\textwidth}
    \caption{Érosion}
    \includegraphics[scale=0.25]{Smatou_erosion_mathematica.png}
    \end{subfigure}
    \caption{Les opérateurs de dilatation et d'érosion sur Smatou}
    \end{figure}    

    \end{frame}
%%%%
%%%%
    \begin{frame}
    \frametitle{Et comment ça fonctionne?}
    \begin{enumerate}
    \item Dilatation:= $\alpha \oplus \beta = \{a+b|a\in \alpha \wedge b\in \beta\}$ 
    \item Érosion:= $\alpha \ominus \beta = \{a-b|a\in \alpha \wedge b\in \beta\}$ 
    \end{enumerate}     
    \begin{itemize}
    \item Addition et différence de Minkowski:

    \end{itemize}
    \begin{tikzpicture}
  \begin{axis}[ 
    xlabel = {},
    ylabel = {},
    xmin = 0, xmax = 5,
    ymin = 0, ymax = 5,
    axis lines=left] 
    \addplot coordinates {(1,1)};
    \addplot coordinates {(2,2)};
  \end{axis}
\end{tikzpicture}
    \end{frame}
%%%%

%%%%
    \begin{frame}
    \frametitle{Et visuellement?}

    \begin{figure}
    \centering

    \printmatrix{Dilatation}{{
            {w,w,w,w,w,w,w},
            {w,w,c,c,c,w,w},
            {w,w,C,C,c,c,w},
            {w,w,b,C,C,c,w},
            {w,w,w,C,C,c,w},
            {w,w,w,C,C,c,w},
            {w,w,c,C,C,c,w},
            {w,w,b,C,C,c,w},
            {w,w,w,w,w,w,w},
            {w,w,w,w,w,w,w}%  %
        }}
    \printmatrix{Érosion}{{
            {w,w,w,w,w,w,w},
            {w,w,w,w,w,w,w},
            {w,w,b,b,w,w,w},
            {w,w,C,b,b,w,w},
            {w,w,w,C,b,w,w},
            {w,w,w,C,b,w,w},
            {w,w,w,C,b,w,w},
            {w,w,b,C,b,w,w},
            {w,w,w,w,w,w,w},
            {w,w,w,w,w,w,w}%  %
        }}
    \printmatrixa{Élément structurant}{{{b,b},{o,b}}}

    \caption{Dilatation et érosion sur une image binaire}
     \label{fig:dilatation1}

    \end{figure}

    \end{frame}

%%%%
    \begin{frame}
    \frametitle{Algèbre des relations}


    \begin{figure}
    \centering
    \begin{subfigure}[b]{0.31\textwidth}
    \caption{Smatou}
    \includegraphics[scale=0.144]{Smatou_avant.png}
    \end{subfigure}
    ~
    \begin{subfigure}[b]{0.31\textwidth}
    \caption{Dilatation}
    \includegraphics[scale=0.144]{Smatou_apres_dilatation.png}
    \end{subfigure}
    ~
    \begin{subfigure}[b]{0.31\textwidth}
    \caption{Érosion}
    \includegraphics[scale=0.144]{Smatou_apres_erosion.png}
    \end{subfigure}
    \caption{Les opérateurs de dilatation et d'érosion}

    \end{figure}    


    \end{frame}


%SECTION SURVOL 
\section{Un survol des logiciels utilisés}
    \begin{frame}

    \begin{chronology}[4]{1}{16}{\textwidth}
    \event{1}{\RelView}
    \pause
    \event{3}{\LaTeX}
    \pause
    \event{6}{Mathematica}
    \pause
    \event{13}{MATLAB}
    \end{chronology}

    \begin{figure}[!h]
    \visible<3->{\includegraphics[scale=0.13]{Mathematica_Logo.png}}
    \visible<2->{\includegraphics[scale=0.13]{LaTeX_Logo.png}}
    \visible<1->{\includegraphics[scale=0.4]{RPE_Logo.png}}
    \visible<4->{\includegraphics[scale=0.1]{Matlab_Logo.png}}
    \end{figure}

    \end{frame}



%SECTION PROGRAMMATION
\section{Une présentation des programmes}
    \begin{frame}
    \frametitle{Dilation}
    \end{frame}


%SECTION LECTURES
\section{Lectures}
    \begin{frame}
    \frametitle{Lectures}
    \end{frame}

%SECTION CONCLUSION
\section{Conclusion}
    \begin{frame}   
    \frametitle{Conclusion}
    \pause
    \begin{itemize}
    \item {Connaissance théorique}
    \pause
    \item {Connaissance logiciels}
    \pause
    \item {Aptitudes}
    \end{itemize}
    \end{frame}


\end{document}
}

以下是生成的情节:

这是我想要的:

这就是我想要的

答案1

您必须将两个坐标放在一个括号组中。

\documentclass{beamer}
\usepackage{pgfplots}

\begin{document}
\begin{frame}
  \begin{tikzpicture}
    \begin{axis}[ 
      xmin = 0, xmax = 5,
      ymin = 0, ymax = 5,
      axis lines=left,
      ] 
      \addplot coordinates {(1,1) (2,2)};
    \end{axis}
  \end{tikzpicture}
\end{frame}
\end{document}

在此处输入图片描述

相关内容