Tikz:填充抛物线和圆箭头

Tikz:填充抛物线和圆箭头

我编辑了代码以填充区域并绘制圆形箭头。箭头向上显示,如下所示:

http://www.directupload.net/file/d/3751/q4ohidu4_pdf.htm

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{ngerman}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{pgfplots}
\usepackage{color}
\begin{document}
\definecolor{darkred}{rgb}{1.0,0.2,0.2}

\begin{figure} 
\begin{tikzpicture}
 %\draw[help lines] (0,0) grid (10,10);
 \draw [->, thick] (-3,0) -- (0,0) -- (3,0);
 \node at (3.2,0) {$\vec{k}$};
 \draw [->, thick] (0,0) -- (0,5);
 \node at (0,5.5) {$\varepsilon(\vec{k})$};
 \draw [thick, domain=-2:2] plot (\x, {\x*\x});
 \draw [thick, dashed] (-2,3.0) -- (2,3.0);
 \draw [fill, red] (1,3) circle [radius=0.05];
 \draw [fill, red] (2,4.2) circle [radius=0.05];
 \draw [fill, red] (3,2) circle [radius=0.05]; 
 \draw [thick] (2.5,2) -- (3.5,2);
 \draw [->, thick] (3,1.70) -- (3,2.30);
 \begin{scope}
    \clip [domain=-2:2]plot (\x, {\x*\x});
    \fill [darkgray, opacity=0.4] (-2,0) rectangle (2,3);
 \end{scope}
 \draw[thick,-stealth] plot [smooth,tension=.55] coordinates {(3.0,2.0) (2,4.2) (1.0,3.0)};
\end{tikzpicture}
\end{figure}

\end{document}

答案1

也许是这样的:

 \documentclass{article}
 \usepackage{tikz}
 \begin{document}
 \begin{tikzpicture}
 \draw[help lines] (0,0) grid (10,10);

 \draw [->, thick] (-3,0) -- (0,0) -- (3,0);
 \node at (3.2,0) {$\vec{k}$};
 \draw [->, thick] (0,0) -- (0,5);
 \node at (0,5.5) {$\varepsilon(\vec{k})$};
 \draw [thick, domain=-2:2] plot (\x, {\x*\x});
 \begin{scope}
    \clip [domain=-2:2]plot (\x, {\x*\x});
    \fill [blue, opacity=0.4] (-2,0) rectangle (2,3);
 \end{scope}
 \draw [thick, dashed] (-2,3.0) -- (2,3.0);
 \draw [fill, red] (1,3) circle [radius=0.05];
 \draw [fill, red] (2,4.2) circle [radius=0.05];
 \draw [fill, red] (3,2) circle [radius=0.05];
 \draw [thick] (2.5,2) -- (3.5,2);
 \draw[thick,-stealth] plot [smooth,tension=.55] coordinates {(3.0,2.0) (2,4.2) (1.0,3.0)};
\end{tikzpicture}
 \end{document}

您需要用clip抛物线进行填充。要连接点,您可以使用带坐标的图。该tension选项将更改曲线的“圆度”,.55这是默认值。

在此处输入图片描述

答案2

pgfplots

\documentclass[border=5]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\usepgfplotslibrary{fillbetween}
\begin{document}
   \begin{tikzpicture}
     \begin{axis}[
     axis lines=middle,
    axis equal,
    grid=both,
    xlabel=$\vec{k}$,
    ylabel=$ε(\vec{k})$,
    no marks,
    domain=-2:2,
    xmax=4,xmin=-3,ymax=3,ymin=0,samples=100,
    ]
       \addplot[red,thick,name path=a] {(x^2)};
       \addplot[blue,thick,name path=b,dashed] {2} ;
       \addplot[fill=none] fill between[of=a and b,split,
           every segment no 1/.style={fill,orange,opacity=.4},] ;
       \draw [fill, red] (axis cs: 1,3) circle [radius=0.05];
        \draw [fill, red] (axis cs: 2,4.2) circle [radius=0.05];
        \draw [thick] (axis cs: 2.5,2) -- (axis cs: 3.5,2);
        \draw [fill, red] (axis cs: 3,2) circle [radius=0.05];
        \addplot[->,thick,smooth,samples=100] coordinates{
       (3.0,2.0) (2,4.2) (1.0,3.0)};
     \end{axis}
   \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容