1

Is possible to make graph, with one linear ordinate on the left and different on the right but logarithmical?

In MWE below, there is my attempt, which is not working. I am getting these errors:

**C:\Program Files (x86)\MiKTeX 2.9\tex\latex\pgfplots\pgfplots.sty:227: Paragraph ended before \pgfflt@readlowlevelfloat was complete.

C:\Program Files (x86)\MiKTeX 2.9\tex\latex\pgfplots\pgfplots.sty:233: Package pgfplots Error: Sorry, nested axis environments are not supported. Please move the inner axis environment below \end{axis} and use alignment options (for example named nodes, see manual) to place it at the desired position.

C:\Program Files (x86)\MiKTeX 2.9\tex\latex\pgfplots\pgfplots.sty:233: TeX capacity exceeded, sorry [input stack size=5000]. []]**

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat = newest}

\begin{document}

    \begin{semilogyaxis}[
      axis y line*=left,  
      y axis style=blue!75!black,  
      xlabel=vykon (dBm),
      ylabel={\textsl{BER} [--]}
    ]
    \addplot[smooth,mark=x,blue] 
      coordinates{
    (-7.740,6.20E-10)
    (-8.860,6.38E-10)
    (-9,.50,7.51E-10)
    (-10.87,1.05E-08)
    (-11.92,1.02E-08)
    (-12.97,1.63E-10)
    (-14.06,2.39E-10)
    (-15.15,3.02E-10)
    (-16.20,5.89E-10)
    (-17.33,1.19E-08)
    (-18.50,1.08E-07)
    (-19.74,7.93E-07)
    (-21.10,6.64E-06)
    (-22.55,5.78E-05)
    (-24.17,3.56E-04) 
    };
    \end{semilogyaxis}

    \begin{axis}[
      axis y line*=right,
      axis x line=none,
      ylabel={\textsl{BER} [--]},
      y axis style=red!75!black
    ]
    \addplot[smooth,mark=*,red] 
      coordinates{
        (0,0)
        (0.0148,48) 
        (0.0295,66)
        (0.0441,66)
        (0.059,45.0) 
    };
    \end{axis}

    \end{tikzpicture}

\end{document}

1 Answer 1

2

You are missing \begin{tikzpicture}, have written y axis style instead of y axis line style, and have a typo on the third coordinate of the first plot: 9,.50 should be 9.50.

plotyy

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat = newest}

\begin{document}

\begin{tikzpicture}
    \begin{semilogyaxis}[
        axis y line*=left,  
        y axis line style=blue!75!black,  
        xlabel=vykon (dBm),
        ylabel={\textsl{BER} [--]}
        ]
        \addplot[smooth,mark=x,blue] 
        coordinates{
            (-7.740,6.20E-10)
            (-8.860,6.38E-10)
            (-9.50,7.51E-10)
            (-10.87,1.05E-08)
            (-11.92,1.02E-08)
            (-12.97,1.63E-10)
            (-14.06,2.39E-10)
            (-15.15,3.02E-10)
            (-16.20,5.89E-10)
            (-17.33,1.19E-08)
            (-18.50,1.08E-07)
            (-19.74,7.93E-07)
            (-21.10,6.64E-06)
            (-22.55,5.78E-05)
            (-24.17,3.56E-04) 
        };
    \end{semilogyaxis}  

    \begin{axis}[
        axis y line*=right,
        axis x line=none,
        ylabel={\textsl{BER} [--]},
        y axis line style=red!75!black
        ]
        \addplot[smooth,mark=*,red] 
        coordinates{
            (0,0)
            (0.0148,48) 
            (0.0295,66)
            (0.0441,66)
            (0.059,45.0) 
        };
    \end{axis}
\end{tikzpicture}


\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .