اذهب إلى المحتوى

السؤال

نشر (معدل)

رسمت بالاعتماد على LaTeX رسم على شكل درجات، باستخدام الكود المبين أسفله:

\begin{tikzpicture}
\node[scale=0.1] (a) at (1.5,1.5) {\phantom{$.$}};
\node[scale=0.1] (b) at (1.5,0.5) {\phantom{$.$}};
\node[scale=0.9] (c) at (7,3.5) {{$N_{\alpha}(t)$}};
\node[scale=0.9] (e) at (6,3) {{$N_d(t)$}};
\node[scale=0.1] (f) at (3.8,2.1) {\phantom{$.$}};
\node[scale=0.9] (g) at (5,1.5) {{Area $u(t)$}};
\draw[<->] (a) edge node[midway,fill=white] {{\scriptsize X($t$)}} (b);
\draw[-] (f)--(g);
\draw[thick,->] (0,0) -- (8,0) node[anchor=north west] {Time $t$};
\draw[thick,blue] (0,0) -- (0,0.5);
\draw[thick,blue] (0,0.5) -- (0.7,0.5);
\draw[thick,blue] (0.7,0.5) -- (0.7,1);
\draw[thick,blue] (0.7,1) -- (1.1,1);
\draw[thick,blue] (1.1,1) -- (1.1,1.5);
\draw[thick,blue] (1.1,1.5) -- (2,1.5);
\draw[thick,blue] (2,1.5) -- (2,2);
\draw[thick,blue] (2,2) -- (3,2);
\draw[thick,blue] (3,2) -- (3,2.5);
\draw[thick,blue] (3,2.5) -- (3.6,2.5);
\draw[thick,blue] (3.6,2.5) -- (3.6,3);
\draw[thick,blue] (3.6,3) -- (4.6,3);
\draw[thick,blue] (4.6,3) -- (4.6,3.5);
\draw[thick,blue] (4.6,3.5) -- (5.7,3.5);

\draw[thick,purple] (1,0) -- (1,0.5);
\draw[thick,purple] (1,0.5) -- (1.7,0.5);
\draw[thick,purple] (1.7,0.5) -- (1.7,1);
\draw[thick,purple] (1.7,1) -- (2.1,1);
\draw[thick,purple] (2.1,1) -- (2.1,1.5);
\draw[thick,purple] (2.1,1.5) -- (2.6,1.5);
\draw[thick,purple] (2.6,1.5) -- (2.6,2);
\draw[thick,purple] (2.6,2) -- (4,2);
\draw[thick,purple] (4,2) -- (4,2.5);
\draw[thick,purple] (4,2.5) -- (5,2.5);
\draw[thick,purple] (5,2.5) -- (5,3);
\draw[thick,purple] (5,3) -- (5.5,3);
\draw[thick,purple] (5.5,3) -- (5.5,3.5);
\draw[thick,purple] (5.5,3.5) -- (6.5,3.5);
\end{tikzpicture}

النتيجة المحصل عليها جيدة إلى حد ما، لكن ينقصني ملء المنطقة area بلون معين:

yLoic.thumb.png.353b9b63472853bc6df26c55

فكيف ذلك؟

تم التعديل في بواسطة Badraoui

Recommended Posts

  • 0
نشر (معدل)

قمت بإنجاز نفس الرسم باستعمال pgfplots, ثم استعملت الخاصية addplot لتلوين المنطقة المحددة.

هذا هو الكود المصدري للرسمة:

\documentclass[mathserif]{beamer}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\pgfplotsset{compat=1.12}

\begin{document}
\vspace*{1in}
\begin{tikzpicture}
\begin{axis}[
    xlabel = Time $t$,
    xmin=-1,xmax = 9,
    hide y axis,
    axis x line=bottom,
    xticklabels={,,},
    xtick style = {draw = none},]
\node[scale=0.1] (a) at (axis cs: 1.5,1.5) {\phantom{$.$}};
\node[scale=0.1] (b) at (axis cs: 1.5,0.5) {\phantom{$.$}};
\node[scale=0.9] (c) at (axis cs: 7,3.5) {{$N_{\alpha}(t)$}};
\node[scale=0.9] (e) at (axis cs: 6,3) {{$N_d(t)$}};
\node[scale=0.1] (f) at (axis cs: 3.8,2.1) {\phantom{$.$}};
\node[scale=0.9] (g) at (axis cs: 5,1.5) {{Area $u(t)$}};
\draw[<->] (a) edge node[midway,] {{\scriptsize X($t$)}} (b);
\draw[-] (f)--(g);
\addplot[name path = A,no markers,color=blue,thick] coordinates {
(0,0)
(0,0.5)
(0.7,0.5)
(0.7,1)
(1.1,1)
(1.1,1.5)
(2,1.5)
(2,2)
(3,2)
(3,2.5)
(3.6,2.5)
(3.6,3)
(4.6,3)
(4.6,3.5)
(5.7,3.5)
};
\addplot[name path = B,no markers,color=purple,thick] coordinates {
(1,0)
(1,0.5)
(1.7,0.5)
(1.7,1)
(2.1,1)
(2.1,1.5)
(2.6,1.5)
(2.6,2)
(4,2)
(4,2.5)
(5,2.5)
(5,3)
(5.5,3)
(5.5,3.5)
(6.5,3.5) };
 \addplot[gray!50] fill between[of=A and B];
\end{axis}
\end{tikzpicture}
\end{document}

UnSYL.thumb.png.f61eb2b9ec01b81d87318360

تم التعديل في بواسطة E.Nourddine

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...