gnuplot set y2axis range from colum












0















I have the following data file:



# Throughput(op/sec)  Num_tr   Bytes_sent(sec)
3000 10 12000
... ... ...


Where throughput is the number of operation per second a client is able to do, Num_tr is the number of threads, and bytes_sent is the number of bytes sent per second.



Now, I am able to plot the thread vs. Throughput graph, getting for example 10 on my x axis and 3000 on my y axis. However, since Bytes_sent and Throughput strictly correlates, I wanted to also use the y2axis command to show the bytes sent in the same plot. The ticks position should be the same, but the value of the y2tics should correspond to ($3 / $1) * the y2tick value defined in the range (1000, 2000, 3000)



set yrange [0:18000]
set ytics nomirror
set y2label 'Throughput (op/sec)'
set y2tics 5
set y2label 'Bytes_sent'
set y2range [0:18000 *($3 / $1)] <----------------
plot "data.dat" index 0 using 2:1:xtic(2) ...


Any idea?



Thanks in advance










share|improve this question





























    0















    I have the following data file:



    # Throughput(op/sec)  Num_tr   Bytes_sent(sec)
    3000 10 12000
    ... ... ...


    Where throughput is the number of operation per second a client is able to do, Num_tr is the number of threads, and bytes_sent is the number of bytes sent per second.



    Now, I am able to plot the thread vs. Throughput graph, getting for example 10 on my x axis and 3000 on my y axis. However, since Bytes_sent and Throughput strictly correlates, I wanted to also use the y2axis command to show the bytes sent in the same plot. The ticks position should be the same, but the value of the y2tics should correspond to ($3 / $1) * the y2tick value defined in the range (1000, 2000, 3000)



    set yrange [0:18000]
    set ytics nomirror
    set y2label 'Throughput (op/sec)'
    set y2tics 5
    set y2label 'Bytes_sent'
    set y2range [0:18000 *($3 / $1)] <----------------
    plot "data.dat" index 0 using 2:1:xtic(2) ...


    Any idea?



    Thanks in advance










    share|improve this question



























      0












      0








      0








      I have the following data file:



      # Throughput(op/sec)  Num_tr   Bytes_sent(sec)
      3000 10 12000
      ... ... ...


      Where throughput is the number of operation per second a client is able to do, Num_tr is the number of threads, and bytes_sent is the number of bytes sent per second.



      Now, I am able to plot the thread vs. Throughput graph, getting for example 10 on my x axis and 3000 on my y axis. However, since Bytes_sent and Throughput strictly correlates, I wanted to also use the y2axis command to show the bytes sent in the same plot. The ticks position should be the same, but the value of the y2tics should correspond to ($3 / $1) * the y2tick value defined in the range (1000, 2000, 3000)



      set yrange [0:18000]
      set ytics nomirror
      set y2label 'Throughput (op/sec)'
      set y2tics 5
      set y2label 'Bytes_sent'
      set y2range [0:18000 *($3 / $1)] <----------------
      plot "data.dat" index 0 using 2:1:xtic(2) ...


      Any idea?



      Thanks in advance










      share|improve this question
















      I have the following data file:



      # Throughput(op/sec)  Num_tr   Bytes_sent(sec)
      3000 10 12000
      ... ... ...


      Where throughput is the number of operation per second a client is able to do, Num_tr is the number of threads, and bytes_sent is the number of bytes sent per second.



      Now, I am able to plot the thread vs. Throughput graph, getting for example 10 on my x axis and 3000 on my y axis. However, since Bytes_sent and Throughput strictly correlates, I wanted to also use the y2axis command to show the bytes sent in the same plot. The ticks position should be the same, but the value of the y2tics should correspond to ($3 / $1) * the y2tick value defined in the range (1000, 2000, 3000)



      set yrange [0:18000]
      set ytics nomirror
      set y2label 'Throughput (op/sec)'
      set y2tics 5
      set y2label 'Bytes_sent'
      set y2range [0:18000 *($3 / $1)] <----------------
      plot "data.dat" index 0 using 2:1:xtic(2) ...


      Any idea?



      Thanks in advance







      plot graph gnuplot






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 '18 at 23:56







      Ema Esp

















      asked Nov 22 '18 at 23:31









      Ema EspEma Esp

      317




      317
























          1 Answer
          1






          active

          oldest

          votes


















          0














          You have two choices



          (1) You can link y2 to y1 using the "set link" command and providing the equations relating bytes sent and throughput



          total_time = <you know this, I take it?>
          throughput(bytes_sent) = bytes_sent / total_time
          bytes(throughput) = throughput * total_time
          set link y2 via throughput(y) inverse bytes(y)
          set ytics 5 nomirror
          set y2tics nomirror # range will exactly track y1
          plot "data.dat" index 0 using 2:1


          I don't know what you intended with "xtics(1)" but it cannot be correct since column 1 is being used for y values, not x values.



          (2) You can plot them independently



          plot "data.dat" index 0 using 2:1 axes x1y1, 
          "data.dat" index 0 using 2:(thoughput($1)) axes x1y2


          In this case you do not need to link the axes or set the ranges explicitly. The plot will have two lines, but if the correlation is perfect they will superimpose.






          share|improve this answer


























          • yeah, sorry for xticks(1), I updated it

            – Ema Esp
            Nov 22 '18 at 23:56











          • I didn't understand (1), I know total time but it shouldn't be relevant for this plot. Looking at the data I see that each bytes_sent / throughput in each row produces a slightly different value, so it is not a constant value I can simply multiply with the throughput. Sorry for the confusion

            – Ema Esp
            Nov 23 '18 at 0:05











          • "total time" may be the wrong description. Whatever time interval it is that you are using to generate the throughput values. I.e., whatever time interval makes the pair of equations throughput(bytes) and bytes(througput) correct for your data.

            – Ethan
            Nov 23 '18 at 0:18











          • Ok, I understood. Thank you!

            – Ema Esp
            Nov 23 '18 at 9:29











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2fstackoverflow.com%2fquestions%2f53439072%2fgnuplot-set-y2axis-range-from-colum%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









          0














          You have two choices



          (1) You can link y2 to y1 using the "set link" command and providing the equations relating bytes sent and throughput



          total_time = <you know this, I take it?>
          throughput(bytes_sent) = bytes_sent / total_time
          bytes(throughput) = throughput * total_time
          set link y2 via throughput(y) inverse bytes(y)
          set ytics 5 nomirror
          set y2tics nomirror # range will exactly track y1
          plot "data.dat" index 0 using 2:1


          I don't know what you intended with "xtics(1)" but it cannot be correct since column 1 is being used for y values, not x values.



          (2) You can plot them independently



          plot "data.dat" index 0 using 2:1 axes x1y1, 
          "data.dat" index 0 using 2:(thoughput($1)) axes x1y2


          In this case you do not need to link the axes or set the ranges explicitly. The plot will have two lines, but if the correlation is perfect they will superimpose.






          share|improve this answer


























          • yeah, sorry for xticks(1), I updated it

            – Ema Esp
            Nov 22 '18 at 23:56











          • I didn't understand (1), I know total time but it shouldn't be relevant for this plot. Looking at the data I see that each bytes_sent / throughput in each row produces a slightly different value, so it is not a constant value I can simply multiply with the throughput. Sorry for the confusion

            – Ema Esp
            Nov 23 '18 at 0:05











          • "total time" may be the wrong description. Whatever time interval it is that you are using to generate the throughput values. I.e., whatever time interval makes the pair of equations throughput(bytes) and bytes(througput) correct for your data.

            – Ethan
            Nov 23 '18 at 0:18











          • Ok, I understood. Thank you!

            – Ema Esp
            Nov 23 '18 at 9:29
















          0














          You have two choices



          (1) You can link y2 to y1 using the "set link" command and providing the equations relating bytes sent and throughput



          total_time = <you know this, I take it?>
          throughput(bytes_sent) = bytes_sent / total_time
          bytes(throughput) = throughput * total_time
          set link y2 via throughput(y) inverse bytes(y)
          set ytics 5 nomirror
          set y2tics nomirror # range will exactly track y1
          plot "data.dat" index 0 using 2:1


          I don't know what you intended with "xtics(1)" but it cannot be correct since column 1 is being used for y values, not x values.



          (2) You can plot them independently



          plot "data.dat" index 0 using 2:1 axes x1y1, 
          "data.dat" index 0 using 2:(thoughput($1)) axes x1y2


          In this case you do not need to link the axes or set the ranges explicitly. The plot will have two lines, but if the correlation is perfect they will superimpose.






          share|improve this answer


























          • yeah, sorry for xticks(1), I updated it

            – Ema Esp
            Nov 22 '18 at 23:56











          • I didn't understand (1), I know total time but it shouldn't be relevant for this plot. Looking at the data I see that each bytes_sent / throughput in each row produces a slightly different value, so it is not a constant value I can simply multiply with the throughput. Sorry for the confusion

            – Ema Esp
            Nov 23 '18 at 0:05











          • "total time" may be the wrong description. Whatever time interval it is that you are using to generate the throughput values. I.e., whatever time interval makes the pair of equations throughput(bytes) and bytes(througput) correct for your data.

            – Ethan
            Nov 23 '18 at 0:18











          • Ok, I understood. Thank you!

            – Ema Esp
            Nov 23 '18 at 9:29














          0












          0








          0







          You have two choices



          (1) You can link y2 to y1 using the "set link" command and providing the equations relating bytes sent and throughput



          total_time = <you know this, I take it?>
          throughput(bytes_sent) = bytes_sent / total_time
          bytes(throughput) = throughput * total_time
          set link y2 via throughput(y) inverse bytes(y)
          set ytics 5 nomirror
          set y2tics nomirror # range will exactly track y1
          plot "data.dat" index 0 using 2:1


          I don't know what you intended with "xtics(1)" but it cannot be correct since column 1 is being used for y values, not x values.



          (2) You can plot them independently



          plot "data.dat" index 0 using 2:1 axes x1y1, 
          "data.dat" index 0 using 2:(thoughput($1)) axes x1y2


          In this case you do not need to link the axes or set the ranges explicitly. The plot will have two lines, but if the correlation is perfect they will superimpose.






          share|improve this answer















          You have two choices



          (1) You can link y2 to y1 using the "set link" command and providing the equations relating bytes sent and throughput



          total_time = <you know this, I take it?>
          throughput(bytes_sent) = bytes_sent / total_time
          bytes(throughput) = throughput * total_time
          set link y2 via throughput(y) inverse bytes(y)
          set ytics 5 nomirror
          set y2tics nomirror # range will exactly track y1
          plot "data.dat" index 0 using 2:1


          I don't know what you intended with "xtics(1)" but it cannot be correct since column 1 is being used for y values, not x values.



          (2) You can plot them independently



          plot "data.dat" index 0 using 2:1 axes x1y1, 
          "data.dat" index 0 using 2:(thoughput($1)) axes x1y2


          In this case you do not need to link the axes or set the ranges explicitly. The plot will have two lines, but if the correlation is perfect they will superimpose.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 22 '18 at 23:57

























          answered Nov 22 '18 at 23:53









          EthanEthan

          1,796267




          1,796267













          • yeah, sorry for xticks(1), I updated it

            – Ema Esp
            Nov 22 '18 at 23:56











          • I didn't understand (1), I know total time but it shouldn't be relevant for this plot. Looking at the data I see that each bytes_sent / throughput in each row produces a slightly different value, so it is not a constant value I can simply multiply with the throughput. Sorry for the confusion

            – Ema Esp
            Nov 23 '18 at 0:05











          • "total time" may be the wrong description. Whatever time interval it is that you are using to generate the throughput values. I.e., whatever time interval makes the pair of equations throughput(bytes) and bytes(througput) correct for your data.

            – Ethan
            Nov 23 '18 at 0:18











          • Ok, I understood. Thank you!

            – Ema Esp
            Nov 23 '18 at 9:29



















          • yeah, sorry for xticks(1), I updated it

            – Ema Esp
            Nov 22 '18 at 23:56











          • I didn't understand (1), I know total time but it shouldn't be relevant for this plot. Looking at the data I see that each bytes_sent / throughput in each row produces a slightly different value, so it is not a constant value I can simply multiply with the throughput. Sorry for the confusion

            – Ema Esp
            Nov 23 '18 at 0:05











          • "total time" may be the wrong description. Whatever time interval it is that you are using to generate the throughput values. I.e., whatever time interval makes the pair of equations throughput(bytes) and bytes(througput) correct for your data.

            – Ethan
            Nov 23 '18 at 0:18











          • Ok, I understood. Thank you!

            – Ema Esp
            Nov 23 '18 at 9:29

















          yeah, sorry for xticks(1), I updated it

          – Ema Esp
          Nov 22 '18 at 23:56





          yeah, sorry for xticks(1), I updated it

          – Ema Esp
          Nov 22 '18 at 23:56













          I didn't understand (1), I know total time but it shouldn't be relevant for this plot. Looking at the data I see that each bytes_sent / throughput in each row produces a slightly different value, so it is not a constant value I can simply multiply with the throughput. Sorry for the confusion

          – Ema Esp
          Nov 23 '18 at 0:05





          I didn't understand (1), I know total time but it shouldn't be relevant for this plot. Looking at the data I see that each bytes_sent / throughput in each row produces a slightly different value, so it is not a constant value I can simply multiply with the throughput. Sorry for the confusion

          – Ema Esp
          Nov 23 '18 at 0:05













          "total time" may be the wrong description. Whatever time interval it is that you are using to generate the throughput values. I.e., whatever time interval makes the pair of equations throughput(bytes) and bytes(througput) correct for your data.

          – Ethan
          Nov 23 '18 at 0:18





          "total time" may be the wrong description. Whatever time interval it is that you are using to generate the throughput values. I.e., whatever time interval makes the pair of equations throughput(bytes) and bytes(througput) correct for your data.

          – Ethan
          Nov 23 '18 at 0:18













          Ok, I understood. Thank you!

          – Ema Esp
          Nov 23 '18 at 9:29





          Ok, I understood. Thank you!

          – Ema Esp
          Nov 23 '18 at 9:29


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • 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%2fstackoverflow.com%2fquestions%2f53439072%2fgnuplot-set-y2axis-range-from-colum%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

          Wiesbaden

          Marschland

          Dieringhausen