How to give multiple axis the same style/options












4















I would like to pick your brains again on a small issue.



I want to use tikzstyle to describe the style of multiple plots but when I copy and paste the style I use on my plot, I get a compilation error.



Working code :



documentclass{standalone}
usepackage{pgfplots}

begin{document}

defT{10}
defK{10}

begin{tikzpicture}
tikzstyle{Bode}=
tikzstyle{Asymp}=[red,densely dashed,thick=1pt]
tikzstyle{LieuReel}=[thick=1pt]

defFloorW{floor(ln(1/T)/ln(10))}
defCeilW{ceil(ln(1/T)/ln(10))}
defGdbK{20*ln(K)/ln(10)}

begin{semilogxaxis}[height=5cm,width=10cm,xlabel=$omega$,ylabel=$G_{dB}$,grid=both,axis x line=bottom, axis y line = left,ymax=(GdbK+4),xmax=10^(CeilW+2.2)]

addplot [domain=(10^(FloorW-2)):(10^(CeilW+2)),samples=50] {GdbK-(10*(ln(T^2*x^2+1)))/ln(10)}[LieuReel];

addplot [domain=(10^(FloorW-2)):(1/T),samples=2] {GdbK}[Asymp];
addplot [domain=(1/T):(10^(CeilW+2)),samples=2] {GdbK-(10*(ln(T^2*x^2)))/ln(10)}[Asymp];
end{semilogxaxis}
end{tikzpicture}

end{document}


Now, I put the style of my semilogaxis in the tikzstyle{Bode} and type Bode in it instead



tikzstyle{Bode}=[height=5cm,width=10cm,xlabel=$omega$,ylabel=$G_{dB}$,grid=both,axis x line=bottom, axis y line = left,ymax=(GdbK+4),xmax=10^(CeilW+2.2)]
...
begin{semilogxaxis}[Bode]


and it gets me this error:



! Package pgfkeys Error: I do not know the key '/tikz/height', to which you passed '5cm', and I am going to ignore it. Perhaps you misspelled it.See the pgfkeys package documentation for explanation.Type H <return> for immediate help.... end{semilogxaxis}


Can you help me ?










share|improve this question





























    4















    I would like to pick your brains again on a small issue.



    I want to use tikzstyle to describe the style of multiple plots but when I copy and paste the style I use on my plot, I get a compilation error.



    Working code :



    documentclass{standalone}
    usepackage{pgfplots}

    begin{document}

    defT{10}
    defK{10}

    begin{tikzpicture}
    tikzstyle{Bode}=
    tikzstyle{Asymp}=[red,densely dashed,thick=1pt]
    tikzstyle{LieuReel}=[thick=1pt]

    defFloorW{floor(ln(1/T)/ln(10))}
    defCeilW{ceil(ln(1/T)/ln(10))}
    defGdbK{20*ln(K)/ln(10)}

    begin{semilogxaxis}[height=5cm,width=10cm,xlabel=$omega$,ylabel=$G_{dB}$,grid=both,axis x line=bottom, axis y line = left,ymax=(GdbK+4),xmax=10^(CeilW+2.2)]

    addplot [domain=(10^(FloorW-2)):(10^(CeilW+2)),samples=50] {GdbK-(10*(ln(T^2*x^2+1)))/ln(10)}[LieuReel];

    addplot [domain=(10^(FloorW-2)):(1/T),samples=2] {GdbK}[Asymp];
    addplot [domain=(1/T):(10^(CeilW+2)),samples=2] {GdbK-(10*(ln(T^2*x^2)))/ln(10)}[Asymp];
    end{semilogxaxis}
    end{tikzpicture}

    end{document}


    Now, I put the style of my semilogaxis in the tikzstyle{Bode} and type Bode in it instead



    tikzstyle{Bode}=[height=5cm,width=10cm,xlabel=$omega$,ylabel=$G_{dB}$,grid=both,axis x line=bottom, axis y line = left,ymax=(GdbK+4),xmax=10^(CeilW+2.2)]
    ...
    begin{semilogxaxis}[Bode]


    and it gets me this error:



    ! Package pgfkeys Error: I do not know the key '/tikz/height', to which you passed '5cm', and I am going to ignore it. Perhaps you misspelled it.See the pgfkeys package documentation for explanation.Type H <return> for immediate help.... end{semilogxaxis}


    Can you help me ?










    share|improve this question



























      4












      4








      4


      0






      I would like to pick your brains again on a small issue.



      I want to use tikzstyle to describe the style of multiple plots but when I copy and paste the style I use on my plot, I get a compilation error.



      Working code :



      documentclass{standalone}
      usepackage{pgfplots}

      begin{document}

      defT{10}
      defK{10}

      begin{tikzpicture}
      tikzstyle{Bode}=
      tikzstyle{Asymp}=[red,densely dashed,thick=1pt]
      tikzstyle{LieuReel}=[thick=1pt]

      defFloorW{floor(ln(1/T)/ln(10))}
      defCeilW{ceil(ln(1/T)/ln(10))}
      defGdbK{20*ln(K)/ln(10)}

      begin{semilogxaxis}[height=5cm,width=10cm,xlabel=$omega$,ylabel=$G_{dB}$,grid=both,axis x line=bottom, axis y line = left,ymax=(GdbK+4),xmax=10^(CeilW+2.2)]

      addplot [domain=(10^(FloorW-2)):(10^(CeilW+2)),samples=50] {GdbK-(10*(ln(T^2*x^2+1)))/ln(10)}[LieuReel];

      addplot [domain=(10^(FloorW-2)):(1/T),samples=2] {GdbK}[Asymp];
      addplot [domain=(1/T):(10^(CeilW+2)),samples=2] {GdbK-(10*(ln(T^2*x^2)))/ln(10)}[Asymp];
      end{semilogxaxis}
      end{tikzpicture}

      end{document}


      Now, I put the style of my semilogaxis in the tikzstyle{Bode} and type Bode in it instead



      tikzstyle{Bode}=[height=5cm,width=10cm,xlabel=$omega$,ylabel=$G_{dB}$,grid=both,axis x line=bottom, axis y line = left,ymax=(GdbK+4),xmax=10^(CeilW+2.2)]
      ...
      begin{semilogxaxis}[Bode]


      and it gets me this error:



      ! Package pgfkeys Error: I do not know the key '/tikz/height', to which you passed '5cm', and I am going to ignore it. Perhaps you misspelled it.See the pgfkeys package documentation for explanation.Type H <return> for immediate help.... end{semilogxaxis}


      Can you help me ?










      share|improve this question
















      I would like to pick your brains again on a small issue.



      I want to use tikzstyle to describe the style of multiple plots but when I copy and paste the style I use on my plot, I get a compilation error.



      Working code :



      documentclass{standalone}
      usepackage{pgfplots}

      begin{document}

      defT{10}
      defK{10}

      begin{tikzpicture}
      tikzstyle{Bode}=
      tikzstyle{Asymp}=[red,densely dashed,thick=1pt]
      tikzstyle{LieuReel}=[thick=1pt]

      defFloorW{floor(ln(1/T)/ln(10))}
      defCeilW{ceil(ln(1/T)/ln(10))}
      defGdbK{20*ln(K)/ln(10)}

      begin{semilogxaxis}[height=5cm,width=10cm,xlabel=$omega$,ylabel=$G_{dB}$,grid=both,axis x line=bottom, axis y line = left,ymax=(GdbK+4),xmax=10^(CeilW+2.2)]

      addplot [domain=(10^(FloorW-2)):(10^(CeilW+2)),samples=50] {GdbK-(10*(ln(T^2*x^2+1)))/ln(10)}[LieuReel];

      addplot [domain=(10^(FloorW-2)):(1/T),samples=2] {GdbK}[Asymp];
      addplot [domain=(1/T):(10^(CeilW+2)),samples=2] {GdbK-(10*(ln(T^2*x^2)))/ln(10)}[Asymp];
      end{semilogxaxis}
      end{tikzpicture}

      end{document}


      Now, I put the style of my semilogaxis in the tikzstyle{Bode} and type Bode in it instead



      tikzstyle{Bode}=[height=5cm,width=10cm,xlabel=$omega$,ylabel=$G_{dB}$,grid=both,axis x line=bottom, axis y line = left,ymax=(GdbK+4),xmax=10^(CeilW+2.2)]
      ...
      begin{semilogxaxis}[Bode]


      and it gets me this error:



      ! Package pgfkeys Error: I do not know the key '/tikz/height', to which you passed '5cm', and I am going to ignore it. Perhaps you misspelled it.See the pgfkeys package documentation for explanation.Type H <return> for immediate help.... end{semilogxaxis}


      Can you help me ?







      tikz-pgf errors tikz-styles pgfkeys






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 4 hours ago







      LMT-PhD

















      asked 5 hours ago









      LMT-PhDLMT-PhD

      41039




      41039






















          1 Answer
          1






          active

          oldest

          votes


















          4














          tikzstyle{foo}=[..] or the replacement tikzset{foo/.style={..}} looks in the /tikz family of keys, but width, height and the other axis parameters belong to the /pgfplots family, so you get an error that /tikz/width is unknown.



          Instead you can use pgfplotsset{foo/.style={..}}, then the keys are assumed to be in the /pgfplots family.



          By the way, in general it would be better to use newcommand instead of def, because then you won't accidentally overwrite existing macros.



          documentclass{standalone}
          usepackage{pgfplots}

          begin{document}

          newcommandT{10}
          newcommandK{10}

          begin{tikzpicture}[
          Asymp/.style={red,densely dashed,thick=1pt},
          LieuReel/.style={thick=1pt}
          ]


          newcommandFloorW{floor(ln(1/T)/ln(10))}
          newcommandCeilW{ceil(ln(1/T)/ln(10))}
          newcommandGdbK{20*ln(K)/ln(10)}
          pgfplotsset{
          bode/.style={
          height=5cm,
          width=10cm,
          xlabel=$omega$,
          ylabel=$G_{dB}$,
          grid=both,
          axis x line=bottom,
          axis y line = left,
          ymax=(GdbK+4),
          xmax=10^(CeilW+2.2)}
          }
          begin{semilogxaxis}[bode]

          addplot [domain=(10^(FloorW-2)):(10^(CeilW+2)),samples=50] {GdbK-(10*(ln(T^2*x^2+1)))/ln(10)}[LieuReel];

          addplot [domain=(10^(FloorW-2)):(1/T),samples=2] {GdbK}[Asymp];
          addplot [domain=(1/T):(10^(CeilW+2)),samples=2] {GdbK-(10*(ln(T^2*x^2)))/ln(10)}[Asymp];
          end{semilogxaxis}
          end{tikzpicture}

          end{document}





          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "85"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f475338%2fhow-to-give-multiple-axis-the-same-style-options%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4














            tikzstyle{foo}=[..] or the replacement tikzset{foo/.style={..}} looks in the /tikz family of keys, but width, height and the other axis parameters belong to the /pgfplots family, so you get an error that /tikz/width is unknown.



            Instead you can use pgfplotsset{foo/.style={..}}, then the keys are assumed to be in the /pgfplots family.



            By the way, in general it would be better to use newcommand instead of def, because then you won't accidentally overwrite existing macros.



            documentclass{standalone}
            usepackage{pgfplots}

            begin{document}

            newcommandT{10}
            newcommandK{10}

            begin{tikzpicture}[
            Asymp/.style={red,densely dashed,thick=1pt},
            LieuReel/.style={thick=1pt}
            ]


            newcommandFloorW{floor(ln(1/T)/ln(10))}
            newcommandCeilW{ceil(ln(1/T)/ln(10))}
            newcommandGdbK{20*ln(K)/ln(10)}
            pgfplotsset{
            bode/.style={
            height=5cm,
            width=10cm,
            xlabel=$omega$,
            ylabel=$G_{dB}$,
            grid=both,
            axis x line=bottom,
            axis y line = left,
            ymax=(GdbK+4),
            xmax=10^(CeilW+2.2)}
            }
            begin{semilogxaxis}[bode]

            addplot [domain=(10^(FloorW-2)):(10^(CeilW+2)),samples=50] {GdbK-(10*(ln(T^2*x^2+1)))/ln(10)}[LieuReel];

            addplot [domain=(10^(FloorW-2)):(1/T),samples=2] {GdbK}[Asymp];
            addplot [domain=(1/T):(10^(CeilW+2)),samples=2] {GdbK-(10*(ln(T^2*x^2)))/ln(10)}[Asymp];
            end{semilogxaxis}
            end{tikzpicture}

            end{document}





            share|improve this answer




























              4














              tikzstyle{foo}=[..] or the replacement tikzset{foo/.style={..}} looks in the /tikz family of keys, but width, height and the other axis parameters belong to the /pgfplots family, so you get an error that /tikz/width is unknown.



              Instead you can use pgfplotsset{foo/.style={..}}, then the keys are assumed to be in the /pgfplots family.



              By the way, in general it would be better to use newcommand instead of def, because then you won't accidentally overwrite existing macros.



              documentclass{standalone}
              usepackage{pgfplots}

              begin{document}

              newcommandT{10}
              newcommandK{10}

              begin{tikzpicture}[
              Asymp/.style={red,densely dashed,thick=1pt},
              LieuReel/.style={thick=1pt}
              ]


              newcommandFloorW{floor(ln(1/T)/ln(10))}
              newcommandCeilW{ceil(ln(1/T)/ln(10))}
              newcommandGdbK{20*ln(K)/ln(10)}
              pgfplotsset{
              bode/.style={
              height=5cm,
              width=10cm,
              xlabel=$omega$,
              ylabel=$G_{dB}$,
              grid=both,
              axis x line=bottom,
              axis y line = left,
              ymax=(GdbK+4),
              xmax=10^(CeilW+2.2)}
              }
              begin{semilogxaxis}[bode]

              addplot [domain=(10^(FloorW-2)):(10^(CeilW+2)),samples=50] {GdbK-(10*(ln(T^2*x^2+1)))/ln(10)}[LieuReel];

              addplot [domain=(10^(FloorW-2)):(1/T),samples=2] {GdbK}[Asymp];
              addplot [domain=(1/T):(10^(CeilW+2)),samples=2] {GdbK-(10*(ln(T^2*x^2)))/ln(10)}[Asymp];
              end{semilogxaxis}
              end{tikzpicture}

              end{document}





              share|improve this answer


























                4












                4








                4







                tikzstyle{foo}=[..] or the replacement tikzset{foo/.style={..}} looks in the /tikz family of keys, but width, height and the other axis parameters belong to the /pgfplots family, so you get an error that /tikz/width is unknown.



                Instead you can use pgfplotsset{foo/.style={..}}, then the keys are assumed to be in the /pgfplots family.



                By the way, in general it would be better to use newcommand instead of def, because then you won't accidentally overwrite existing macros.



                documentclass{standalone}
                usepackage{pgfplots}

                begin{document}

                newcommandT{10}
                newcommandK{10}

                begin{tikzpicture}[
                Asymp/.style={red,densely dashed,thick=1pt},
                LieuReel/.style={thick=1pt}
                ]


                newcommandFloorW{floor(ln(1/T)/ln(10))}
                newcommandCeilW{ceil(ln(1/T)/ln(10))}
                newcommandGdbK{20*ln(K)/ln(10)}
                pgfplotsset{
                bode/.style={
                height=5cm,
                width=10cm,
                xlabel=$omega$,
                ylabel=$G_{dB}$,
                grid=both,
                axis x line=bottom,
                axis y line = left,
                ymax=(GdbK+4),
                xmax=10^(CeilW+2.2)}
                }
                begin{semilogxaxis}[bode]

                addplot [domain=(10^(FloorW-2)):(10^(CeilW+2)),samples=50] {GdbK-(10*(ln(T^2*x^2+1)))/ln(10)}[LieuReel];

                addplot [domain=(10^(FloorW-2)):(1/T),samples=2] {GdbK}[Asymp];
                addplot [domain=(1/T):(10^(CeilW+2)),samples=2] {GdbK-(10*(ln(T^2*x^2)))/ln(10)}[Asymp];
                end{semilogxaxis}
                end{tikzpicture}

                end{document}





                share|improve this answer













                tikzstyle{foo}=[..] or the replacement tikzset{foo/.style={..}} looks in the /tikz family of keys, but width, height and the other axis parameters belong to the /pgfplots family, so you get an error that /tikz/width is unknown.



                Instead you can use pgfplotsset{foo/.style={..}}, then the keys are assumed to be in the /pgfplots family.



                By the way, in general it would be better to use newcommand instead of def, because then you won't accidentally overwrite existing macros.



                documentclass{standalone}
                usepackage{pgfplots}

                begin{document}

                newcommandT{10}
                newcommandK{10}

                begin{tikzpicture}[
                Asymp/.style={red,densely dashed,thick=1pt},
                LieuReel/.style={thick=1pt}
                ]


                newcommandFloorW{floor(ln(1/T)/ln(10))}
                newcommandCeilW{ceil(ln(1/T)/ln(10))}
                newcommandGdbK{20*ln(K)/ln(10)}
                pgfplotsset{
                bode/.style={
                height=5cm,
                width=10cm,
                xlabel=$omega$,
                ylabel=$G_{dB}$,
                grid=both,
                axis x line=bottom,
                axis y line = left,
                ymax=(GdbK+4),
                xmax=10^(CeilW+2.2)}
                }
                begin{semilogxaxis}[bode]

                addplot [domain=(10^(FloorW-2)):(10^(CeilW+2)),samples=50] {GdbK-(10*(ln(T^2*x^2+1)))/ln(10)}[LieuReel];

                addplot [domain=(10^(FloorW-2)):(1/T),samples=2] {GdbK}[Asymp];
                addplot [domain=(1/T):(10^(CeilW+2)),samples=2] {GdbK-(10*(ln(T^2*x^2)))/ln(10)}[Asymp];
                end{semilogxaxis}
                end{tikzpicture}

                end{document}






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 4 hours ago









                Torbjørn T.Torbjørn T.

                157k13252442




                157k13252442






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f475338%2fhow-to-give-multiple-axis-the-same-style-options%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Рижское политехническое училище

                    Красноярск

                    Is there a gender-neutral alternative to workmanlike suitable for use in legal context?