10

I'm trying to plot a smithchart, which has negative impedances, too. This is how far i got till now:

\documentclass[]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.smithchart}

\makeatletter

\begin{document}

    \begin{tikzpicture}
    \begin{smithchart}[
        yticklabel around circle,
        show origin,
        xtick={-0.3,-0.2,-0.1,0.1,0.2,0.3,0.4,0.5,1,1.5,2,3,4,5,10,20,-20,-10,-5,-4,-3},
    ]

   \addplot[mark=none,line width=2]
       coordinates{
           (1, 0) (1, 0.1) (1,0.2) (1,0.3) (1,0.4) (1,0.5) (1,0.5)
       };
   \end{smithchart}
   \end{tikzpicture} 

\end{document}

The result is not very pleasant, the circles of the y-axis just stop, when the x-values start to get negative:

enter image description here

The goal would be a look similar to this, but I would be happy, if the y-axis would be continued :)

enter image description here

EDIT: So I made same progess. first, I could move the outer circle labeling the x-axis:

\documentclass[preview]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.smithchart}

\makeatletter

\begin{document}

    \begin{tikzpicture}
    \begin{smithchart}[
        yticklabel around circle,
        show origin,
        xtick={-0.3,-0.2,-0.1,0.1,0.2,0.3,0.4,0.5,1,1.5,2,3,4,5,10,20,-20,-10,-5,-4,-3},
        xmin=-0.3, %works quite well
        xmax=-3,    %xmax seems to be always infinty?!?!?
        ticklabel style={opacity=0.5},
    ]

   \addplot[mark=none,line width=2]
       coordinates{
           (1, 0) (1, 0.1) (1,0.2) (1,0.3) (1,0.4) (1,0.5) (1,0.5)
       };
   \end{smithchart}
   \end{tikzpicture} 

\end{document}

The result looks like this, which is not quite satisfying, as xmax is ignored (always near infinty) and drwing lines is just possible inside the old, small (positive-x) circle: x-axis of smithchart moved

And the next thing, drawing y-circles when x is negative, seems also to be possible in some way.

...... %just as before
    \begin{smithchart}[
        yticklabel around circle,
        show origin,
        xtick={-0.3,-0.2,-0.1,0.1,0.2,0.3,0.4,0.5,1,1.5,2,3,4,5,10,20,-20,-10,-5,-4,-3},
        ygrid each nth passes x={-3},
        ticklabel style={opacity=0.5},
    ]

   \addplot[mark=none,line width=2]
       coordinates{
           (1, 0) (1, 0.1) (1,0.2) (1,0.3) (1,0.4) (1,0.5) (1,0.5)
       };
   \end{smithchart}
    .....

And the result: enter image description here

EDIT again: By overlaying two smith charts, it comes again a bit closer to the desired look... But one can't draw lines, where x is negative!

\documentclass[preview]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.smithchart}    
\makeatletter    
\begin{document}

    \begin{tikzpicture}
    \begin{smithchart}[
        show origin,
        xtick={-0.3,-0.2,-0.1,0.1,0.2,0.3,0.4,0.5,1,1.5,2,3,4,5,10,20,-20,-10,-5,-4,-3},
        ygrid stop at x={0.2:-.3,-0.2:-.3,  0.5:-.3,-0.5:-.3,  1:-.3,-1:-.3,  2:-3,-2:-2.99,  5:-6,-5:-5.99,},
        xmin=-0.3, %works quite well
        %xmax=-3,   %xmax seems to be alwys infinty?!?!?
        ticklabel style={white,opacity=0},
    ]
   \end{smithchart}

   \begin{smithchart}[
        show origin,
        xtick={-0.3,-0.2,-0.1,0.1,0.2,0.3,0.4,0.5,1,1.5,2,3,4,5,10,20,-20,-10,-5,-4,-3},
        ygrid stop at x={0.2:-3,-0.2:-3,0.5:-3,-0.5:-3,1:-3,-1:-3,  2:-3.01,-2:-3.0,  5:-6.01,-5:-6.0,},
        xmin=-0.3, %works quite well
        %xmax=-3,   %xmax seems to be alwys infinty?!?!?
        ticklabel style={opacity=0},
    ]

   \addplot[mark=none,line width=2]
       coordinates{
           (1, 0) (1, 0.1) (1,0.2) (1,0.3) (1,0.4) (1,0.5) (1,0.5)
       };
   \addplot[mark=none,line width=0.5]
       coordinates{
           (1, 0) (-0.3, 0)  % this one is not drawn outside!!!
       };
   \end{smithchart}
   \end{tikzpicture} 

\end{document}

enter image description here

7

What you want is more a feature request to that library (which cannot do that kind of graphics).

I can assist with one simple item, though: add clip=false to suppress clipping of \addplot operations -- this will draw your custom axis.

The circles (y grid) which is drawn incompletely is due to the fact that pgfplots computes arcs with precise end points - and that appears to be limited to the positive values. The code which does it contains a comment of sorts "this here is the correct, complete circle" and the code to generate that circle. See \pgfplots@smithchart@draw@yarc in tikzlibrarypgfplots.smithchart.code.tex. If you patch that macro (include the uncommented \pgfpathellipse instead of what follows after it), you can get full circles for y grid lines. You will need to handle the clip path somehow, though.

  • clip=false is a first step :) now I can also draw lines outside. Solving the problem in \pgfplots@smithchart@draw@yarc would be the best solution, but overlaying two axises also works quite well as provisional solution (last picture). Do you also have an idea how to draw the "x-axis-circle" bigger, e.g. "from xmin=-0,3 to xmax=-3", so that it doesn't intersect with x=infty? ;) – Faekynn Jun 21 '14 at 20:04
  • I made a couple of experiments for xmax=-3 without success. I would need to dig deeper into that feature request. – Christian Feuersänger Jun 22 '14 at 16:16
  • in the semester break (august, september), I will look in the code and look for a way for flexible scaling the outer circle, so that there is no limit to make it smaller or bigger than in the current version. But for now, I dont't have the time for it... :( – Faekynn Jun 22 '14 at 18:13
3

So I have a solution, but it's not nice. Perhaps I will look deeper in the code in some months, when I have more time.....

\documentclass[preview]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.smithchart}

  \pgfplotsset{
    axis line style={opacity=1},
    every axis label/.append style ={white,opacity=0},
    every tick label/.append style={white,opacity=0}  
  }
\makeatletter

\begin{document}

    \begin{tikzpicture}
    \begin{smithchart}[
        yticklabel around circle,
        show origin,
    clip=false,
        xtick={-0.2,-0.1,0.1,0.2,0.3,0.4,0.5,1,1.5,2,3,4,5,10,20,-20,-10,-5,-4},
        ygrid stop at x={0.2:-.3,-0.2:-.3,  0.5:-.365,-0.5:-.365,  1:-.63,-1:-.63,  2:-3,-2:-2.99,  5:-6,-5:-5.99,},
    ]
    \addplot[mark=none,line width=0.4,]
          coordinates{
            (-3.5, 0) (-0.285, 0)
        };  
    \draw[black!30] (1,0) arc (-180:-61:0.5) ;
    \draw[black!30] (1,0) arc (180:61:0.5) ;

    \draw[black!30] (1,0) arc (-180:-116:1) ;
    \draw[black!30] (1,0) arc (180:116:1) ;

    \draw[black!30] (1,0) arc (0:-145:1.43) ;
    \draw[black!30] (1,0) arc (0:145:1.43) ;

    \draw[black!30] (1,0) arc (0:-64:2) ;
    \draw[black!30] (1,0) arc (0:64:2) ;

    \draw[black!30] (1,0) -- (1,1.5) ;
    \draw[black!30] (1,0) -- (1,-1.5) ;


    \draw[mark=none,line width=0.5,]
        circle[radius=1.8]{};
   \end{smithchart}

      \begin{smithchart}[
    clip=false,
        yticklabel around circle,
        show origin,
        xtick={-0.2,-0.1,0.1,0.2,0.3,0.4,0.5,1,1.5,2,3,4,5,10,20,-20,-10,-5,-4},
        ygrid stop at x={0.2:-3.5,-0.2:-3.5,0.5:-3.45,-0.5:-3.45,  1:-3.15,-1:-3.15,  2:-3.01,-2:-3.0,  5:-6.01,-5:-6.0,},
        ticklabel style={opacity=0},
    ]

   \addplot[mark=none,line width=2]
       coordinates{
           (1, 0) (1, 0.1) (1,0.2) (1,0.3) (1,0.4) (1,0.5) (1,0.5)
       };
   \end{smithchart}

   \end{tikzpicture} 

\end{document}

The result is not that nice like the picture I proposed in the beginning, but at least it's not wrong. enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.