Math operations with data plots in pgfplots












0















Is there a way to shift the blue curve to the right by a factor of 10 without creating a new data set but rather using the math operations with the blue plot?



enter image description here



Here is the code.



documentclass[a4paper]{article}

usepackage{pgfplots}
usepackage{pgfplotstable}%fitting functions
usepackage{tikz}
usetikzlibrary{tikzmark}
usepackage{pgfplotstable}

%pgfkeys{/pgf/number format/.cd,1000 sep={}}


newcommand{myfont}{fontfamily{cmss}fontseries{ul}selectfont}% used with mathpazo

pgfdeclareplotmark{fat-}
{%
pgfsetlinewidth{1}
pgfpathmoveto{pgfqpoint{pgfplotmarksize}{0pt}}%
pgfpathlineto{pgfqpoint{-pgfplotmarksize}{0pt}}%
pgfusepathqstroke
}%

pgfplotsset{/pgfplots/error bars/error bar style={very thick,blue,mark size=2.5},/pgfplots/error bars/error mark={fat-}}
%pgfplotsset{/pgfplots/label shift={0pt}}

pgfplotsset{compat=1.15}
pgfplotsset{label style={font=Large},
tick label style={font=Large}}

pgfplotsset{error bars/.cd,
x dir=both, x explicit,
y dir=both, y explicit,
}

begin{document}

begin{figure}
centering
begin{tikzpicture}
begin{axis}[
xmode=log,
ymode=log,
enable tick line clipping=false,
width=9cm,
height=7cm,
axis line style=semithick,
legend style={at={(0.95,0.3)},draw=none},
legend cell align={right},
x tick style={black,semithick},
x label style=
{at={(ticklabel cs:0.5)},anchor=near ticklabel},
xlabel={$x$},
xmin=1,xmax=1000,
xtick={1,10,100,1000},
xtick pos=bottom,
minor x tick num=9,
xtick align=outside,
y tick style={black,semithick},
y label style=
{at={(ticklabel cs:0.5)},anchor=near ticklabel},
ylabel={$y$},
ymin=0.5,ymax=5,
ytick={0.1,0.5,1,3,5,10},
ytick pos=left,
minor y tick num=9,
ytick align=outside,
]
addplot [blue,mark=*,mark options={scale=1.5,blue}]
table [x=x,y=y] {
x y
2 0.8
10 1
50 3
};

addplot [red,mark=*,mark options={scale=1.5,red}] table [x=x,y=y] {
x y
20 0.8
100 1
500 3
};

end{axis}
end{tikzpicture}
end{figure}


end{document}









share|improve this question





























    0















    Is there a way to shift the blue curve to the right by a factor of 10 without creating a new data set but rather using the math operations with the blue plot?



    enter image description here



    Here is the code.



    documentclass[a4paper]{article}

    usepackage{pgfplots}
    usepackage{pgfplotstable}%fitting functions
    usepackage{tikz}
    usetikzlibrary{tikzmark}
    usepackage{pgfplotstable}

    %pgfkeys{/pgf/number format/.cd,1000 sep={}}


    newcommand{myfont}{fontfamily{cmss}fontseries{ul}selectfont}% used with mathpazo

    pgfdeclareplotmark{fat-}
    {%
    pgfsetlinewidth{1}
    pgfpathmoveto{pgfqpoint{pgfplotmarksize}{0pt}}%
    pgfpathlineto{pgfqpoint{-pgfplotmarksize}{0pt}}%
    pgfusepathqstroke
    }%

    pgfplotsset{/pgfplots/error bars/error bar style={very thick,blue,mark size=2.5},/pgfplots/error bars/error mark={fat-}}
    %pgfplotsset{/pgfplots/label shift={0pt}}

    pgfplotsset{compat=1.15}
    pgfplotsset{label style={font=Large},
    tick label style={font=Large}}

    pgfplotsset{error bars/.cd,
    x dir=both, x explicit,
    y dir=both, y explicit,
    }

    begin{document}

    begin{figure}
    centering
    begin{tikzpicture}
    begin{axis}[
    xmode=log,
    ymode=log,
    enable tick line clipping=false,
    width=9cm,
    height=7cm,
    axis line style=semithick,
    legend style={at={(0.95,0.3)},draw=none},
    legend cell align={right},
    x tick style={black,semithick},
    x label style=
    {at={(ticklabel cs:0.5)},anchor=near ticklabel},
    xlabel={$x$},
    xmin=1,xmax=1000,
    xtick={1,10,100,1000},
    xtick pos=bottom,
    minor x tick num=9,
    xtick align=outside,
    y tick style={black,semithick},
    y label style=
    {at={(ticklabel cs:0.5)},anchor=near ticklabel},
    ylabel={$y$},
    ymin=0.5,ymax=5,
    ytick={0.1,0.5,1,3,5,10},
    ytick pos=left,
    minor y tick num=9,
    ytick align=outside,
    ]
    addplot [blue,mark=*,mark options={scale=1.5,blue}]
    table [x=x,y=y] {
    x y
    2 0.8
    10 1
    50 3
    };

    addplot [red,mark=*,mark options={scale=1.5,red}] table [x=x,y=y] {
    x y
    20 0.8
    100 1
    500 3
    };

    end{axis}
    end{tikzpicture}
    end{figure}


    end{document}









    share|improve this question



























      0












      0








      0








      Is there a way to shift the blue curve to the right by a factor of 10 without creating a new data set but rather using the math operations with the blue plot?



      enter image description here



      Here is the code.



      documentclass[a4paper]{article}

      usepackage{pgfplots}
      usepackage{pgfplotstable}%fitting functions
      usepackage{tikz}
      usetikzlibrary{tikzmark}
      usepackage{pgfplotstable}

      %pgfkeys{/pgf/number format/.cd,1000 sep={}}


      newcommand{myfont}{fontfamily{cmss}fontseries{ul}selectfont}% used with mathpazo

      pgfdeclareplotmark{fat-}
      {%
      pgfsetlinewidth{1}
      pgfpathmoveto{pgfqpoint{pgfplotmarksize}{0pt}}%
      pgfpathlineto{pgfqpoint{-pgfplotmarksize}{0pt}}%
      pgfusepathqstroke
      }%

      pgfplotsset{/pgfplots/error bars/error bar style={very thick,blue,mark size=2.5},/pgfplots/error bars/error mark={fat-}}
      %pgfplotsset{/pgfplots/label shift={0pt}}

      pgfplotsset{compat=1.15}
      pgfplotsset{label style={font=Large},
      tick label style={font=Large}}

      pgfplotsset{error bars/.cd,
      x dir=both, x explicit,
      y dir=both, y explicit,
      }

      begin{document}

      begin{figure}
      centering
      begin{tikzpicture}
      begin{axis}[
      xmode=log,
      ymode=log,
      enable tick line clipping=false,
      width=9cm,
      height=7cm,
      axis line style=semithick,
      legend style={at={(0.95,0.3)},draw=none},
      legend cell align={right},
      x tick style={black,semithick},
      x label style=
      {at={(ticklabel cs:0.5)},anchor=near ticklabel},
      xlabel={$x$},
      xmin=1,xmax=1000,
      xtick={1,10,100,1000},
      xtick pos=bottom,
      minor x tick num=9,
      xtick align=outside,
      y tick style={black,semithick},
      y label style=
      {at={(ticklabel cs:0.5)},anchor=near ticklabel},
      ylabel={$y$},
      ymin=0.5,ymax=5,
      ytick={0.1,0.5,1,3,5,10},
      ytick pos=left,
      minor y tick num=9,
      ytick align=outside,
      ]
      addplot [blue,mark=*,mark options={scale=1.5,blue}]
      table [x=x,y=y] {
      x y
      2 0.8
      10 1
      50 3
      };

      addplot [red,mark=*,mark options={scale=1.5,red}] table [x=x,y=y] {
      x y
      20 0.8
      100 1
      500 3
      };

      end{axis}
      end{tikzpicture}
      end{figure}


      end{document}









      share|improve this question
















      Is there a way to shift the blue curve to the right by a factor of 10 without creating a new data set but rather using the math operations with the blue plot?



      enter image description here



      Here is the code.



      documentclass[a4paper]{article}

      usepackage{pgfplots}
      usepackage{pgfplotstable}%fitting functions
      usepackage{tikz}
      usetikzlibrary{tikzmark}
      usepackage{pgfplotstable}

      %pgfkeys{/pgf/number format/.cd,1000 sep={}}


      newcommand{myfont}{fontfamily{cmss}fontseries{ul}selectfont}% used with mathpazo

      pgfdeclareplotmark{fat-}
      {%
      pgfsetlinewidth{1}
      pgfpathmoveto{pgfqpoint{pgfplotmarksize}{0pt}}%
      pgfpathlineto{pgfqpoint{-pgfplotmarksize}{0pt}}%
      pgfusepathqstroke
      }%

      pgfplotsset{/pgfplots/error bars/error bar style={very thick,blue,mark size=2.5},/pgfplots/error bars/error mark={fat-}}
      %pgfplotsset{/pgfplots/label shift={0pt}}

      pgfplotsset{compat=1.15}
      pgfplotsset{label style={font=Large},
      tick label style={font=Large}}

      pgfplotsset{error bars/.cd,
      x dir=both, x explicit,
      y dir=both, y explicit,
      }

      begin{document}

      begin{figure}
      centering
      begin{tikzpicture}
      begin{axis}[
      xmode=log,
      ymode=log,
      enable tick line clipping=false,
      width=9cm,
      height=7cm,
      axis line style=semithick,
      legend style={at={(0.95,0.3)},draw=none},
      legend cell align={right},
      x tick style={black,semithick},
      x label style=
      {at={(ticklabel cs:0.5)},anchor=near ticklabel},
      xlabel={$x$},
      xmin=1,xmax=1000,
      xtick={1,10,100,1000},
      xtick pos=bottom,
      minor x tick num=9,
      xtick align=outside,
      y tick style={black,semithick},
      y label style=
      {at={(ticklabel cs:0.5)},anchor=near ticklabel},
      ylabel={$y$},
      ymin=0.5,ymax=5,
      ytick={0.1,0.5,1,3,5,10},
      ytick pos=left,
      minor y tick num=9,
      ytick align=outside,
      ]
      addplot [blue,mark=*,mark options={scale=1.5,blue}]
      table [x=x,y=y] {
      x y
      2 0.8
      10 1
      50 3
      };

      addplot [red,mark=*,mark options={scale=1.5,red}] table [x=x,y=y] {
      x y
      20 0.8
      100 1
      500 3
      };

      end{axis}
      end{tikzpicture}
      end{figure}


      end{document}






      pgfplots






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 11 mins ago









      CarLaTeX

      31.7k551133




      31.7k551133










      asked 16 mins ago









      GagikGagik

      464




      464






















          0






          active

          oldest

          votes











          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%2f475605%2fmath-operations-with-data-plots-in-pgfplots%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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%2f475605%2fmath-operations-with-data-plots-in-pgfplots%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

          Contact image not getting when fetch all contact list from iPhone by CNContact

          count number of partitions of a set with n elements into k subsets

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks