Generate plot coordinates for TikZ draw commandWhen using GraphPlot with an adjacency matrix, how can I make...

Has any spacecraft ever had the ability to directly communicate with civilian air traffic control?

Pressure to defend the relevance of one's area of mathematics

Confused by notation of atomic number Z and mass number A on periodic table of elements

Was it really necessary for the Lunar Module to have 2 stages?

Is there any limitation with Arduino Nano serial communication distance?

What is the incentive for curl to release the library for free?

Reverse the word in a string with the same order in javascript

Killing undead fish underwater

Modify locally tikzset

Is it possible to measure lightning discharges as Nikola Tesla?

Can someone publish a story that happened to you?

What is the difference between `a[bc]d` (brackets) and `a{b,c}d` (braces)?

Is it possible to dynamically set properties of an `Object` using Apex?

What is the most expensive material in the world that could be used to create Pun-Pun's lute?

Smart diagram in Mathematica

Mac Pro install disk keeps ejecting itself

Minimum value of 4 digit number divided by sum of its digits

How can I record the screen and the rear camera on an iPhone simultaneously?

Feels like I am getting dragged in office politics

What does YCWCYODFTRFDTY mean?

Is this a realistic set of world maps?

Any examples of headwear for races with animal ears?

Is creating your own "experiment" considered cheating during a physics exam?

Can solid acids and bases have pH values? If not, how are they classified as acids or bases?



Generate plot coordinates for TikZ draw command


When using GraphPlot with an adjacency matrix, how can I make Mathematica draw exactly one self loop for any non-zero weight?Plot in cylindrical coordinatesContour Plot in Cylindrical CoordinatesPackage for nonlinear plot coordinatesPlot region from given coordinatesPlot command yields wrong value?Manipulate Command and PlotDo with Plot commandPlot in polar coordinatesplot command for two variables













1












$begingroup$


Is there some clever way to generate a TikZ plot sequence of draw coordinates in Mathematica? The following commands works fairly well



y[x_] := Log[2, (2 x - 200)/(x - 200)]
Table[{i, y[i]}, {i, 201, 2000, 10}] // N


but results in the output



{{201., 7.65821}, {211., 4.33498},...


I can post-process it in a text editor but it would better if it could be output in Mathematica as



(201., 7.65821)--
(211., 4.33498)--
(221., 3.52655)--
(231., 3.07923)--
(241., 2.78200)--
...


or something similar, to be easily used with the TikZ draw-command. I could loop through the list and 'format';



Clear[i, y];
y[x_] := Log[2, (2 x - 200)/(x - 200)];
coordinates = Table[{i, y[i]}, {i, 201, 2000, 10}] // N;
tikzlist = {};
For[i = 1, i <= Length[coordinates], i++,
x = coordinates[[i]][[1]];
y = coordinates[[i]][[2]];
tikzlist =
tikzlist <> "(" <> ToString[x] <> "," <> ToString[y] <> ")--";
]
tikzlist = StringTake[tikzlist, StringLength[tikzlist] - 2] <> ";"


but perhaps there is some shorter one-line command that does the job better and more efficiently. TIA.










share|improve this question









$endgroup$

















    1












    $begingroup$


    Is there some clever way to generate a TikZ plot sequence of draw coordinates in Mathematica? The following commands works fairly well



    y[x_] := Log[2, (2 x - 200)/(x - 200)]
    Table[{i, y[i]}, {i, 201, 2000, 10}] // N


    but results in the output



    {{201., 7.65821}, {211., 4.33498},...


    I can post-process it in a text editor but it would better if it could be output in Mathematica as



    (201., 7.65821)--
    (211., 4.33498)--
    (221., 3.52655)--
    (231., 3.07923)--
    (241., 2.78200)--
    ...


    or something similar, to be easily used with the TikZ draw-command. I could loop through the list and 'format';



    Clear[i, y];
    y[x_] := Log[2, (2 x - 200)/(x - 200)];
    coordinates = Table[{i, y[i]}, {i, 201, 2000, 10}] // N;
    tikzlist = {};
    For[i = 1, i <= Length[coordinates], i++,
    x = coordinates[[i]][[1]];
    y = coordinates[[i]][[2]];
    tikzlist =
    tikzlist <> "(" <> ToString[x] <> "," <> ToString[y] <> ")--";
    ]
    tikzlist = StringTake[tikzlist, StringLength[tikzlist] - 2] <> ";"


    but perhaps there is some shorter one-line command that does the job better and more efficiently. TIA.










    share|improve this question









    $endgroup$















      1












      1








      1





      $begingroup$


      Is there some clever way to generate a TikZ plot sequence of draw coordinates in Mathematica? The following commands works fairly well



      y[x_] := Log[2, (2 x - 200)/(x - 200)]
      Table[{i, y[i]}, {i, 201, 2000, 10}] // N


      but results in the output



      {{201., 7.65821}, {211., 4.33498},...


      I can post-process it in a text editor but it would better if it could be output in Mathematica as



      (201., 7.65821)--
      (211., 4.33498)--
      (221., 3.52655)--
      (231., 3.07923)--
      (241., 2.78200)--
      ...


      or something similar, to be easily used with the TikZ draw-command. I could loop through the list and 'format';



      Clear[i, y];
      y[x_] := Log[2, (2 x - 200)/(x - 200)];
      coordinates = Table[{i, y[i]}, {i, 201, 2000, 10}] // N;
      tikzlist = {};
      For[i = 1, i <= Length[coordinates], i++,
      x = coordinates[[i]][[1]];
      y = coordinates[[i]][[2]];
      tikzlist =
      tikzlist <> "(" <> ToString[x] <> "," <> ToString[y] <> ")--";
      ]
      tikzlist = StringTake[tikzlist, StringLength[tikzlist] - 2] <> ";"


      but perhaps there is some shorter one-line command that does the job better and more efficiently. TIA.










      share|improve this question









      $endgroup$




      Is there some clever way to generate a TikZ plot sequence of draw coordinates in Mathematica? The following commands works fairly well



      y[x_] := Log[2, (2 x - 200)/(x - 200)]
      Table[{i, y[i]}, {i, 201, 2000, 10}] // N


      but results in the output



      {{201., 7.65821}, {211., 4.33498},...


      I can post-process it in a text editor but it would better if it could be output in Mathematica as



      (201., 7.65821)--
      (211., 4.33498)--
      (221., 3.52655)--
      (231., 3.07923)--
      (241., 2.78200)--
      ...


      or something similar, to be easily used with the TikZ draw-command. I could loop through the list and 'format';



      Clear[i, y];
      y[x_] := Log[2, (2 x - 200)/(x - 200)];
      coordinates = Table[{i, y[i]}, {i, 201, 2000, 10}] // N;
      tikzlist = {};
      For[i = 1, i <= Length[coordinates], i++,
      x = coordinates[[i]][[1]];
      y = coordinates[[i]][[2]];
      tikzlist =
      tikzlist <> "(" <> ToString[x] <> "," <> ToString[y] <> ")--";
      ]
      tikzlist = StringTake[tikzlist, StringLength[tikzlist] - 2] <> ";"


      but perhaps there is some shorter one-line command that does the job better and more efficiently. TIA.







      plotting






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 4 hours ago









      mf67mf67

      1196




      1196






















          1 Answer
          1






          active

          oldest

          votes


















          2












          $begingroup$

          You can use TextString with its ListFormat option to directly format the list as needed, without any postprocessing:



          TextString[
          TextString[#, ListFormat -> {"(", ", ", ")"}] & /@ tab1,
          ListFormat -> {"", "--n", ""}
          ]
          (*
          (201., 7.65821)--
          (211., 4.33498)--
          (221., 3.52655)--
          (231., 3.07923)--
          (241., 2.782)--

          *)





          share|improve this answer









          $endgroup$













          • $begingroup$
            That's even better !
            $endgroup$
            – High Performance Mark
            4 hours ago












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "387"
          };
          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%2fmathematica.stackexchange.com%2fquestions%2f197241%2fgenerate-plot-coordinates-for-tikz-draw-command%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









          2












          $begingroup$

          You can use TextString with its ListFormat option to directly format the list as needed, without any postprocessing:



          TextString[
          TextString[#, ListFormat -> {"(", ", ", ")"}] & /@ tab1,
          ListFormat -> {"", "--n", ""}
          ]
          (*
          (201., 7.65821)--
          (211., 4.33498)--
          (221., 3.52655)--
          (231., 3.07923)--
          (241., 2.782)--

          *)





          share|improve this answer









          $endgroup$













          • $begingroup$
            That's even better !
            $endgroup$
            – High Performance Mark
            4 hours ago
















          2












          $begingroup$

          You can use TextString with its ListFormat option to directly format the list as needed, without any postprocessing:



          TextString[
          TextString[#, ListFormat -> {"(", ", ", ")"}] & /@ tab1,
          ListFormat -> {"", "--n", ""}
          ]
          (*
          (201., 7.65821)--
          (211., 4.33498)--
          (221., 3.52655)--
          (231., 3.07923)--
          (241., 2.782)--

          *)





          share|improve this answer









          $endgroup$













          • $begingroup$
            That's even better !
            $endgroup$
            – High Performance Mark
            4 hours ago














          2












          2








          2





          $begingroup$

          You can use TextString with its ListFormat option to directly format the list as needed, without any postprocessing:



          TextString[
          TextString[#, ListFormat -> {"(", ", ", ")"}] & /@ tab1,
          ListFormat -> {"", "--n", ""}
          ]
          (*
          (201., 7.65821)--
          (211., 4.33498)--
          (221., 3.52655)--
          (231., 3.07923)--
          (241., 2.782)--

          *)





          share|improve this answer









          $endgroup$



          You can use TextString with its ListFormat option to directly format the list as needed, without any postprocessing:



          TextString[
          TextString[#, ListFormat -> {"(", ", ", ")"}] & /@ tab1,
          ListFormat -> {"", "--n", ""}
          ]
          (*
          (201., 7.65821)--
          (211., 4.33498)--
          (221., 3.52655)--
          (231., 3.07923)--
          (241., 2.782)--

          *)






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 4 hours ago









          Lukas LangLukas Lang

          7,53511032




          7,53511032












          • $begingroup$
            That's even better !
            $endgroup$
            – High Performance Mark
            4 hours ago


















          • $begingroup$
            That's even better !
            $endgroup$
            – High Performance Mark
            4 hours ago
















          $begingroup$
          That's even better !
          $endgroup$
          – High Performance Mark
          4 hours ago




          $begingroup$
          That's even better !
          $endgroup$
          – High Performance Mark
          4 hours ago


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematica 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.


          Use MathJax to format equations. MathJax reference.


          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%2fmathematica.stackexchange.com%2fquestions%2f197241%2fgenerate-plot-coordinates-for-tikz-draw-command%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

          “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

          How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

          夢乃愛華...