Hi all,
i will have to draw some plot for digital signals similar to the one
attached.
I'm already satisfied with the result but i would like to know if its
possible to obtain same result
with easiest code. I understand that pgfplots is not focused on this kind
of plots but it's the tool I know (not so better as I would like).
Questions:
1.- Node with velocity (Velocitat) is not completely drawn unless ymax
overpasses it. Could it be independent?
2.- I've managed to show bit intervals with \draw[dashed] inside
\pgfplotsforeachungrouped. Would it be possible to draw them with ticks or
grid (not so large as plot)?
3.- Do you know a better way of labelig each bit (another
\pgfplotsforeachungrouped)?
Thank you,
Ignasi
%------------------------------------------------
\documentclass[border=3mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[font=\sffamily]
\begin{axis}[x=1cm,y=1cm,
every axis plot post/.append style={mark=none},
cycle list name=exotic,
axis y line=left,
axis x line=middle,
xmax=10,
ymin=-0.2,
ymax=2.8,
xtick={8},
xticklabels={1},
ytick={0,1},
yticklabels={Nivell 1, Nivell 2},
xlabel={temps},
every axis y label/.style={at={(current axis.above
origin)},anchor=north
east},
every axis x label/.style={at={(current axis.right of
origin)},anchor=north east},
ylabel={Amplitud},
every axis plot/.append style={line width=2pt},
]
\addplot+[const plot] coordinates {(0,1) (1,0) (2,1) (4,0) (7,1) (8,0)};
\pgfplotsforeachungrouped \i/\j in {1/0,0/1,1/2,1/3,0/4,0/5,0/6,1/7}
{\edef\temp{\noexpand\node at ([xshift=.5cm]axis cs:\j,1.3) {\i};}\temp}
\pgfplotsforeachungrouped \i in {1,2,...,8}
{\edef\temp{\noexpand\draw[dashed] (axis cs:\i,0)--(axis
cs:\i,1.5);}\temp}
\draw[<->] (axis cs:0,1.7) -- (axis cs:8,1.7) node [midway,above,text
width=3cm,font=\sffamily\small,align=center]{8 bits en 1 segon\\Velocitat
= 8 bps};
\node[font=\sffamily] at (axis cs:8.5,0.2) {\dots};
%
\end{axis}
\end{tikzpicture}
\end{document}
%----------------------------------------------------
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Pgfplots-features mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pgfplots-features