Graphics, Figures & Tables ⇒ pgfplots | Data from *. s1p Files for Smith Diagramm
pgfplots | Data from *. s1p Files for Smith Diagramm
Dear all,
I have found that pgfplots can plot Smith diagrams, but I have not yet found an option to directly import a *.s1p file which contains the data of such a Smith chart.
Does someone knows such option ?
Thanks a lot,
Best regards,
Hadrien
I have found that pgfplots can plot Smith diagrams, but I have not yet found an option to directly import a *.s1p file which contains the data of such a Smith chart.
Does someone knows such option ?
Thanks a lot,
Best regards,
Hadrien
NEW: TikZ book now 40% off at Amazon.com for a short time.

-
- Posts: 34
- Joined: Sun Oct 16, 2011 5:56 pm
pgfplots | Data from *. s1p Files for Smith Diagramm
Hi Hadrian,
An .s1p file seems to be some quite specific data format generated and/or used by 3rd party software. What is it? How is it defined?
If you have data files, pgfplots supports table format or perhaps the explicit coordinate input format. For Smith charts, it expects either untransformed complex values as input (default) or, with
Best regards
Christian
An .s1p file seems to be some quite specific data format generated and/or used by 3rd party software. What is it? How is it defined?
If you have data files, pgfplots supports table format or perhaps the explicit coordinate input format. For Smith charts, it expects either untransformed complex values as input (default) or, with
is smithchart cs=true
, cartesian coordinates inside of the unit circle.Best regards
Christian
-
- Posts: 2
- Joined: Sat May 23, 2015 4:33 pm
pgfplots | Data from *. s1p Files for Smith Diagramm
Hi!
Found this very old thread and it would have saved me hours if there would have been some examples on the usage. Here is some code with some examples on how to use this.
The following code assumes a standard s1p-File with row1 being the Frequency, row2 the real part and row3 the imaginary part:
The output can be seen in the attachment.
Found this very old thread and it would have saved me hours if there would have been some examples on the usage. Here is some code with some examples on how to use this.
The following code assumes a standard s1p-File with row1 being the Frequency, row2 the real part and row3 the imaginary part:
! ListType=Lin
! Comment=PCB-Spule_N10
# MHz S RI R 50
0.1000000 -0.9712057 0.0205816
0.2333556 -0.9715719 0.0436983
0.3667111 -0.9699207 0.0673892
0.5000667 -0.9677658 0.0899401
0.6334223 -0.9641644 0.1142959
0.7667779 -0.9615511 0.1367883
0.9001334 -0.9574007 0.1607424
1.0334890 -0.9530981 0.1832266
(...)
Code: Select all
Code, edit and compile here:
% !TeX encoding = UTF-8% !TeX spellcheck = de_DE\documentclass[11pt,border=0mm]{standalone}\usepackage[utf8]{inputenc}\usepackage{amsmath}\usepackage{amsfonts}\usepackage{amssymb}\usepackage{graphicx}\usepackage{tikz}\usepackage{pgfplots}\pgfplotsset{compat=1.12}\usetikzlibrary{plotmarks}\usepgfplotslibrary{smithchart}%Command to create a vertical, gray, dashed line in plots\newcommand{\vasymptote}[2][]{\draw [color=gray,densely dashed,#1] ({rel axis cs:0,0} -| {axis cs:#2,0}) -- ({rel axis cs:0,1} -| {axis cs:#2,0});}\begin{document}\begin{tikzpicture}\begin{axis}[width=0.95\textwidth,height=7.5cm, %xmin=0,xmax=75,ymin=-80,xlabel={frequency [GHz]},ylabel={},legend pos=south west]\vasymptote {76.88} %First item-be in the bg.\addplot[color=red] table[skip first n=2, %Ignore the first two lines (comment and ListType)x index=0, %in which column to find the x-valuesy expr={\thisrowno{1}} %in which column to find the y-values] {data/test.s1p};\addlegendentry{$Re(\Gamma=s_{11})$}\addplot[color=blue] table[skip first n=2, x index=0, y expr={\thisrowno{2}}] {data/test.s1p};
- Attachments
-
- test.pdf
- Code: See post.
- (63.69 KiB) Downloaded 263 times
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
pgfplots | Data from *. s1p Files for Smith Diagramm
Hi and welcome, thanks for sharing you solution.
One minor thing. The real and imaginary parts are either typeset in Fraktur, or in the upright form. In the latter, it could be confused with the Reynolds number, depending on your readership. Please consider the following:
One minor thing. The real and imaginary parts are either typeset in Fraktur, or in the upright form. In the latter, it could be confused with the Reynolds number, depending on your readership. Please consider the following:
Code: Select all
Code, edit and compile here:
\documentclass{article}\usepackage{mathtools}\begin{document}$a = \Re{(a + b\mathrm i)} $ und $b = \Im{(a + b\mathrm i)}$\par\renewcommand{\Re}{\mathrm{Re}} \renewcommand{\Im}{\mathrm{Im}}$a = \Re{(a + b\mathrm i)} $ und $b = \Im{(a + b\mathrm i)}$\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
-
- Posts: 2
- Joined: Sat May 23, 2015 4:33 pm
pgfplots | Data from *. s1p Files for Smith Diagramm
Hi again.
@Johannes: Oh, thanks I've been looking for something like this. Wouldn't a renewcomand usually belong in front of begin[document]?
I also wanted to share my code for .s2p-Files and some more tricks for nice results:
Results in:
And
Results in:
I know this code is not that well documented, but I hope it helps anyway.
Now I come to another thing: Admittance Smith Charts. Though they seem a little buggy, I got this working:
Results in:
Please note that, as far as I know, the plus/minus sign of the admittance chart is wrong.
If you have any questions about this code (please only about the code, since my knowledge of LaTex is very limited), you can contact me via master (youknowwhat) aypac.de
@Johannes: Oh, thanks I've been looking for something like this. Wouldn't a renewcomand usually belong in front of begin[document]?
I also wanted to share my code for .s2p-Files and some more tricks for nice results:
Code: Select all
Code, edit and compile here:
% !TeX encoding = UTF-8% !TeX spellcheck = de_DE\documentclass[11pt,border=0mm]{standalone}\usepackage[utf8]{inputenc}\usepackage{amsmath}\usepackage{amsfonts}\usepackage{amssymb}\usepackage{graphicx}\usepackage{pgfplots}\usepackage{tikz}\usepackage[]{units}% Style to select only points from #1 to #2 (inclusive)\pgfplotsset{select coords between index/.style 2 args={x filter/.code={\ifnum\coordindex<#1\def\pgfmathresult{}\fi\ifnum\coordindex>#2\def\pgfmathresult{}\fi}}}%Command to create a vertical dashed line in Plots\newcommand{\vasymptote}[2][]{\draw [color=gray,densely dashed,#1] ({rel axis cs:0,0} -| {axis cs:#2,0}) -- ({rel axis cs:0,1} -| {axis cs:#2,0});}\usepgfplotslibrary{smithchart}%\usepgfplotslibrary[smithchart]%\usetikzlibrary{pgfplots.smithchart}%\usetikzlibrary[pgfplots.smithchart]\pgfplotsset{compat=1.12}%a4: width=21.00cm, height=29.70cm%borders 2.5cm each side => width=16.00cm*0.95=15.2cm%\usepackage[left=2cm, right=1cm, top=1cm, bottom=1cm]{geometry}\begin{document}
And
Code: Select all
Code, edit and compile here:
% !TeX encoding = UTF-8% !TeX spellcheck = de_DE\documentclass[11pt,border=0mm]{standalone}\usepackage[utf8]{inputenc}\usepackage{amsmath}\usepackage{amsfonts}\usepackage{amssymb}\usepackage{graphicx}\usepackage{pgfplots}\usepackage{tikz}\usepackage[]{units}% Style to select only points from #1 to #2 (inclusive)\pgfplotsset{select coords between index/.style 2 args={x filter/.code={\ifnum\coordindex<#1\def\pgfmathresult{}\fi\ifnum\coordindex>#2\def\pgfmathresult{}\fi}}}%Command to create a vertical dashed line in Plots\newcommand{\vasymptote}[2][]{\draw [color=gray,densely dashed,#1] ({rel axis cs:0,0} -| {axis cs:#2,0}) -- ({rel axis cs:0,1} -| {axis cs:#2,0});}\usepgfplotslibrary{smithchart}\pgfplotsset{compat=1.12}%a4: width=21.00cm, height=29.70cm%borders 2.5cm each side => width=16.00cm*0.95=15.2cm%\usepackage[left=2cm, right=1cm, top=1cm, bottom=1cm]{geometry}\begin{document}\begin{tikzpicture}\begin{smithchart}[
Now I come to another thing: Admittance Smith Charts. Though they seem a little buggy, I got this working:
Code: Select all
Code, edit and compile here:
% !TeX encoding = UTF-8% !TeX spellcheck = de_DE\documentclass[11pt,border=0mm]{standalone}\usepackage[utf8]{inputenc}\usepackage{amsmath}\usepackage{amsfonts}\usepackage{amssymb}\usepackage{graphicx}\usepackage{pgfplots}\usepackage{tikz}\usepackage[]{units}% Style to select only points from #1 to #2 (inclusive)\pgfplotsset{select coords between index/.style 2 args={x filter/.code={\ifnum\coordindex<#1\def\pgfmathresult{}\fi\ifnum\coordindex>#2\def\pgfmathresult{}\fi}}}%Command to create a vertical dashed line in Plots\newcommand{\vasymptote}[2][]{\draw [color=gray,densely dashed,#1] ({rel axis cs:0,0} -| {axis cs:#2,0}) -- ({rel axis cs:0,1} -| {axis cs:#2,0});}\usepgfplotslibrary{smithchart}%a4: width=21.00cm, height=29.70cm%borders 2.5cm each side => width=16.00cm*0.95=15.2cm%\usepackage[left=2cm, right=1cm, top=1cm, bottom=1cm]{geometry}\begin{document}\begin{tikzpicture}[]% First, the Admittance chart:
If you have any questions about this code (please only about the code, since my knowledge of LaTex is very limited), you can contact me via master (youknowwhat) aypac.de
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Re: pgfplots | Data from *. s1p Files for Smith Diagramm
There are certain places where it completely fine to redefine a command within documents. Here i had to do, or nobody would have seen any changes 

The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.