评论

评论

为了展示方程的不连续性,我想绘制下图。 在此处输入图片描述

我们如何制作 45 度线?此外,我们如何制作空白点?

我目前的代码是:

\begin{tikzpicture}
\draw[thick, ->] (0,0)--(5,0) node[below]{$p_1$};
\draw[thick, ->] (0,0)--(0,5) node[left]{$p_2$};
\draw[Blue,-] (1,5)--(1,1.1);
\draw[Blue, -] (1,1)--(3.5,3.4);
\draw[Blue, -] (3.5,3.5)--(5,3.5);
\draw[dotted] (0,1) node[left]{$c$}--(1,1);
\draw[dotted] (1,0) node[below]{$c$}--(1,1);
\draw[dotted] (0,3.5) node [left]{$\frac{A+Bc}{2}$}--(3.5,3.5);
\draw[dotted] (3.5,0) node [below]{$\frac{A+Bc}{2}$}--(3.5,3.5);
\fill[Blue] (1,1.1) circle (1.5pt);
\fill[Blue] (3.5,3.4) circle (1.5pt);
\end{tikzpicture}

答案1

评论

我定义了两种新的节点样式fullempty线末端的点。

执行

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[
        full/.style = {circle,draw,fill,inner sep=1pt},
        empty/.style = {circle,draw,fill=white,inner sep=1pt}
    ]
    % To be added
    \draw[help lines] (0,0) -- (45:7);
    \draw (0,0)+(0:0.9) arc(0:45:0.9);
    \node at (22.5:0.6) {$45^\circ$};
    %
    \draw[thick,->] (0,0)--(5,0) node[below]{$p_1$};
    \draw[thick,->] (0,0)--(0,5) node[left]{$p_2$};
    \draw[blue,-] (1,5)--(1,1.1) node[empty] {};
    \draw[blue,-] (1,1) node[full] {} --(3.5,3.4) node[full] {};
    \draw[blue,-] (3.5,3.5) node[empty] {} --(5,3.5);
    \draw[dotted] (0,1) node[left]{$c$}--(1,1);
    \draw[dotted] (1,0) node[below]{$c$}--(1,1);
    \draw[dotted] (0,3.5) node [left]{$\frac{A+Bc}{2}$}--(3.5,3.5);
    \draw[dotted] (3.5,0) node [below]{$\frac{A+Bc}{2}$}--(3.5,3.5);
    % Another discontinuous one
    \draw[green] (0,2) -- (3,2) node[empty] (A) {};
    \draw[green] (3,1.5) node[full] (B) {} -- (4,1) node[empty] (C) {};
    \draw[green] (4,2) node[full] (D) {} -- (5,5);
    \draw[dotted] (A) -- (B) (C) -- (D);
    \draw[<-] (A) -- +(-0.7,1) node[above] {\tiny Very discontinuous!};
\end{tikzpicture}
\end{document}

输出

在此处输入图片描述

相关内容