summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikz-osci/tikz-osci.sty
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/tikz-osci/tikz-osci.sty')
-rw-r--r--graphics/pgf/contrib/tikz-osci/tikz-osci.sty139
1 files changed, 114 insertions, 25 deletions
diff --git a/graphics/pgf/contrib/tikz-osci/tikz-osci.sty b/graphics/pgf/contrib/tikz-osci/tikz-osci.sty
index 29d2541911..73ab24f5da 100644
--- a/graphics/pgf/contrib/tikz-osci/tikz-osci.sty
+++ b/graphics/pgf/contrib/tikz-osci/tikz-osci.sty
@@ -8,14 +8,14 @@
% tained anymore.
%
% Author: Thibault Giauffret
-% Date: 2013/10/07
-% Version: 0.2.0
+% Date: 2013/10/08
+% Version: 0.3.0
% Licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf
% Not an expert... Just doing it for fun.
% -----------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tikz-osci}[2023/09/30 0.2.0 Tikz Osci package]
+\ProvidesPackage{tikz-osci}[2023/10/08 0.3.0 Tikz Osci package]
% Required packages
\RequirePackage[dvipsnames]{xcolor}
@@ -51,6 +51,10 @@
sample rate=200,
xy mode/.store in=\xyMode,
xy mode=0,
+ math mode/.store in=\mathMode,
+ math mode=0,
+ math mode hide source/.store in=\mathModeHideSource,
+ math mode hide source=0,
func one/.store in=\funcOne,
func one=2*sin(2*180/0.020*x),
func two/.store in=\funcTwo,
@@ -65,10 +69,10 @@
color two=1053AF,
color text two/.store in=\colorTextTwo,
color text two=FFFFFF,
- color xy/.store in=\colorXY,
- color xy=2E8B73,
- color text xy/.store in=\colorTextXY,
- color text xy=FFFFFF,
+ color three/.store in=\colorThree,
+ color three=2E8B73,
+ color text three/.store in=\colorTextThree,
+ color text three=FFFFFF,
graph back color/.store in=\graphBackColor,
graph back color=FFFFFF,
info back color/.store in=\infoBackColor,
@@ -97,7 +101,7 @@
% Set the colors
\definecolor{firstcolor}{HTML}{\colorOne}
\definecolor{secondcolor}{HTML}{\colorTwo}
- \definecolor{thirdcolor}{HTML}{\colorXY}
+ \definecolor{thirdcolor}{HTML}{\colorThree}
\definecolor{graphbackcolor}{HTML}{\graphBackColor}
\definecolor{infoBackColor}{HTML}{\infoBackColor}
\definecolor{infoTextColor}{HTML}{\infoTextColor}
@@ -105,7 +109,7 @@
\definecolor{gridColor}{HTML}{\gridColor}
\definecolor{colorTextOne}{HTML}{\colorTextOne}
\definecolor{colorTextTwo}{HTML}{\colorTextTwo}
- \definecolor{colorTextXY}{HTML}{\colorTextXY}
+ \definecolor{colorTextThree}{HTML}{\colorTextThree}
% Draw the info box
\draw[black,thick, fill= infoBackColor]
@@ -119,6 +123,51 @@
% Add time/div label
\draw (5,-0.15) node[anchor=north, color= infoTextColor] {\timeDiv\ ms/div};
+ % Add XY mode indicator
+ % Lissajou mode
+ \ifnum\xyMode=1
+
+ \draw[thirdcolor,fill=thirdcolor] (4,-0.78) rectangle (6,-1.28);
+ \draw (5,-0.75) node[anchor=north, color=colorTextThree] {XY mode};
+
+ \else
+
+ % Add mode
+ \ifnum\mathMode=1
+
+ \draw[thirdcolor,fill=thirdcolor] (4,-0.78) rectangle (6,-1.28);
+ \draw (5,-0.75) node[anchor=north, color=colorTextThree] {Add};
+
+ \else
+
+ % Substract mode
+ \ifnum\mathMode=2
+
+ \draw[thirdcolor,fill=thirdcolor] (4,-0.78) rectangle (6,-1.28);
+ \draw (5,-0.75) node[anchor=north, color=colorTextThree] {Substract};
+
+ \else
+
+ % Multiply mode
+ \ifnum\mathMode=3
+
+ \draw[thirdcolor,fill=thirdcolor] (4,-0.78) rectangle (6,-1.28);
+ \draw (5,-0.75) node[anchor=north, color=colorTextThree] {Multiply};
+
+ \else
+
+ % Divide mode
+ \ifnum\mathMode=4
+
+ \draw[thirdcolor,fill=thirdcolor] (4,-0.78) rectangle (6,-1.28);
+ \draw (5,-0.75) node[anchor=north, color=colorTextThree] {Divide};
+
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+
% Add voltage/div label for the first channel
\draw[firstcolor,fill=firstcolor] (0.5,-0.15) rectangle (1.5,-0.6);
\draw (1,-0.1) node[anchor=north, color=colorTextOne] {CH1};
@@ -131,12 +180,6 @@
\draw (9,-0.75) node[anchor=north, color= infoTextColor] {\voltageDivTwo\ V/div};
\fi
- % Add the XY mode label
- \ifnum\xyMode=1
- % \draw (5,-0.75) node[anchor=north, color=thirdcolor] {XY mode};
- % Coming soon...
- \fi
-
% Draw the oscilloscope screen border
\draw[black,thick, fill= graphbackcolor]
(0,0) --
@@ -175,27 +218,73 @@
\pgfplotsset{ every non boxed x axis/.append style={x axis line style=-},
every non boxed y axis/.append style={y axis line style=-}}
+ % Lissajou mode
\ifnum\xyMode=1
- % Coming soon...
+ \addplot
+ [domain=0:360,variable=\x,
+ samples=200,smooth,very thick,color=thirdcolor]
+ ({(\funcOne)/\voltageDivOne},{(\funcTwo)/\voltageDivTwo});
+ \draw[thirdcolor,fill=thirdcolor] (4,-0.78) rectangle (6,-1.28);
+ \draw (5,-0.75) node[anchor=north, color=white] {XY mode};
\else
- % Draw each channel separately
- % First channel plot
- \addplot[color=firstcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000),
- smooth, samples=\sampleRate]{(\funcOne)/\voltageDivOne+\screenOffsetOne};
+ \ifnum\mathModeHideSource=0
+ % Draw each channel separately
+ % First channel plot
+ \addplot[color=firstcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000),
+ smooth, samples=\sampleRate]{(\funcOne)/\voltageDivOne+\screenOffsetOne};
- % If the second channel is enabled, draw it
- \ifnum\secondChannel=1
- % Draw the second channel
- \addplot[color=secondcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000), smooth, samples=\sampleRate]{(\funcTwo)/\voltageDivTwo+\screenOffsetTwo};
+ % If the second channel is enabled, draw it
+ \ifnum\secondChannel=1
+ % Draw the second channel
+ \addplot[color=secondcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000), smooth, samples=\sampleRate]{(\funcTwo)/\voltageDivTwo+\screenOffsetTwo};
+
+ \fi
+ \fi
+
+ % Add mode
+ \ifnum\mathMode=1
+ \addplot[color=thirdcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000),
+ smooth, samples=\sampleRate]{(\funcOne)/\voltageDivOne + (\funcTwo)/\voltageDivTwo};
+
+ \else
+
+ % Substract mode
+ \ifnum\mathMode=2
+ \addplot[color=thirdcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000),
+ smooth, samples=\sampleRate]{(\funcOne)/\voltageDivOne - (\funcTwo)/\voltageDivTwo};
+ \draw[thirdcolor,fill=thirdcolor] (4,-0.78) rectangle (6,-1.28);
+ \draw (5,-0.75) node[anchor=north, color=white] {Substract};
+
+ \else
+
+ % Multiply mode
+ \ifnum\mathMode=3
+ \addplot[color=thirdcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000),
+ smooth, samples=\sampleRate]{(\funcOne)/\voltageDivOne * (\funcTwo)/\voltageDivTwo};
+ \draw[thirdcolor,fill=thirdcolor] (4,-0.78) rectangle (6,-1.28);
+ \draw (5,-0.75) node[anchor=north, color=white] {Multiply};
+
+ \else
+
+ % Divide mode
+ \ifnum\mathMode=4
+ \addplot[color=thirdcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000),
+ smooth, samples=\sampleRate]{(\funcOne)/\voltageDivOne / (\funcTwo)/\voltageDivTwo};
+ \draw[thirdcolor,fill=thirdcolor] (4,-0.78) rectangle (6,-1.28);
+ \draw (5,-0.75) node[anchor=north, color=white] {Divide};
+ \fi
+ \fi
+ \fi
\fi
\fi
\end{axis}
- \ifnum\xyMode=0
+ \ifnum\xyMode=1
+ \else
\ifnum\indicators=1
% Draw the first channel's screen marker
\draw[firstcolor,fill=firstcolor] (0.4, \screenOffsetOne+4) -- (0, \screenOffsetOne+4+0.3) -- (0, \screenOffsetOne+4-0.3) -- cycle;