Dynamic plot with variable line length from csv tableRotate a node but not its content: the case of the...

Rivers without rain

Why do games have consumables?

Why was Germany not as successful as other Europeans in establishing overseas colonies?

Can I spend a night at Vancouver then take a flight to my college in Toronto as an international student?

Combinable filters

To say I met a person for the first time

How to reduce LED flash rate (frequency)

What does it mean to express a gate in Dirac notation?

How could Tony Stark make this in Endgame?

How to creep the reader out with what seems like a normal person?

Apply MapThread to all but one variable

How can I place the product on a social media post better?

Please, smoke with good manners

How can I practically buy stocks?

how to find the equation of a circle given points of the circle

Does a semiconductor follow Ohm's law?

Symbolic Multivariate Distribution

Is the claim "Employers won't employ people with no 'social media presence'" realistic?

Is this homebrew Wind Wave spell balanced?

Pulling the rope with one hand is as heavy as with two hands?

What's the polite way to say "I need to urinate"?

French for 'It must be my imagination'?

Critique of timeline aesthetic

How to stop co-workers from teasing me because I know Russian?



Dynamic plot with variable line length from csv table


Rotate a node but not its content: the case of the ellipse decorationplotting two time series with boundsHow to define the default vertical distance between nodes?Numerical conditional within tikz keys?TikZ/ERD: node (=Entity) label on the insidepgfplots won't plot from CSVTikZ: Drawing an arc from an intersection to an intersectionLine up nested tikz enviroments or how to get rid of thempgfplots: percentage in matrix plotplot matrix directly from csv with headers













0















I need to draw a dynamic diagram that is based on the following table:



Abbreviation Percentage
A 70
S 35
C 0
R 0
E 0
I 0


and it needs to look like this
enter image description here



So far this is what I got



documentclass{article}
usepackage{graphicx}
usepackage{xcolor}
usepackage{color}
usepackage{fancyhdr}
usepackage{amsmath}
usepackage{calc}
usepackage{tikz}
usetikzlibrary{spy}
usetikzlibrary{fit,calc,positioning}
usetikzlibrary{shapes.geometric}
usetikzlibrary{arrows}
usepackage{filecontents}
usepackage{pgfplotstable}
usepackage{ifthen}
usepackage{etoolbox}
usepackage{tabulary}
usepackage{readarray}
usepackage{array}



definecolor{hashc}{HTML}{00A3E5}
definecolor{diagramgray}{HTML}{D0D0D0}
definecolor{textdarkgray}{HTML}{585858}

begin{filecontents*}{topatributtes.csv}
Abbreviation, percentage
R, 0
I, 0
E, 0
A, 70
S, 35
C, 0
end{filecontents*}

begin{document}

% read table data and sort
pgfplotstableread[col sep=comma,columns={Abbreviation,percentage}]{topatributtes.csv}datatableA
pgfplotstablesort[sort key={percentage}, sort cmp=int >]{datatablesorted}{datatableA}
pgfplotstablegetrowsof{datatablesorted}
pgfmathsetmacro{RowsInTable}{pgfplotsretval-1}

begin{tikzpicture}
begin{scope}
tikzstyle{mypoligon} = [draw=none,regular polygon, rotate=-45,regular polygon sides=12]
foreach x/y in {0.10625/a, 0.2125/b, 0.31875/c, 0.425/d, 0.53125/e, 0.6375/f, 0.74375/g}
{
node[mypoligon,minimum size=xtextwidth] (y) at (0,0) {};
}
foreach pol in {a,b,c,d,e,f,g}{
foreach n [remember=n as lastn (initially 11)] in {1, 3, ..., 11} {
path[draw=diagramgray] (pol.corner lastn) -- (pol.corner n);
}
}

draw[diagramgray] (g.corner 1) -- (0,0) -- (g.corner 11) (0,0) -- (g.corner 7) (g.corner 5) -- (0,0);
draw[fill=blue] circle [radius=1mm] {};


% Draw abbreviation names in corners
foreach k/a/x/y in {0/3/0/2, 1/1/2/2, 2/11/2/-1, 3/9/0/-2, 4/7/-2/-1, 5/5/-2/2}{
pgfplotstablegetelem{k}{Abbreviation}of{datatablesorted}
draw (g.corner a) node[xshift=x mm,yshift=y mm] (pgfplotsretval) {footnotesize textbf{pgfplotsretval}};
pgfplotstablegetelem{k}{percentage}of{datatablesorted}

% Draw lines from center to percentage value - this goes always to the max
pgfmathtruncatemacro{itest}{pgfplotsretval>0}
ifnumitest=1
draw (0,0) -- (g.corner a) ;
fi
}

foreach pol/i in {a/10,b/20,c/30,d/40,e/50,f/60,g/70}{
draw (pol.corner 3) node[yshift=0.3]{fontsize{6pt}{10pt}selectfont color{textdarkgray}textsl{i}};
}

end{scope}
end{tikzpicture}

end{document}


and this is how it looks like
enter image description here



My question is how can I scale the blue lines so they match the values from the table? Problem is that I have 8 polygons (nodes a-g) and range of values for each abbreviation can go from 0 to 70. Using ifthen command would take forever.. Thanks..









share







New contributor




Almic7 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I need to draw a dynamic diagram that is based on the following table:



    Abbreviation Percentage
    A 70
    S 35
    C 0
    R 0
    E 0
    I 0


    and it needs to look like this
    enter image description here



    So far this is what I got



    documentclass{article}
    usepackage{graphicx}
    usepackage{xcolor}
    usepackage{color}
    usepackage{fancyhdr}
    usepackage{amsmath}
    usepackage{calc}
    usepackage{tikz}
    usetikzlibrary{spy}
    usetikzlibrary{fit,calc,positioning}
    usetikzlibrary{shapes.geometric}
    usetikzlibrary{arrows}
    usepackage{filecontents}
    usepackage{pgfplotstable}
    usepackage{ifthen}
    usepackage{etoolbox}
    usepackage{tabulary}
    usepackage{readarray}
    usepackage{array}



    definecolor{hashc}{HTML}{00A3E5}
    definecolor{diagramgray}{HTML}{D0D0D0}
    definecolor{textdarkgray}{HTML}{585858}

    begin{filecontents*}{topatributtes.csv}
    Abbreviation, percentage
    R, 0
    I, 0
    E, 0
    A, 70
    S, 35
    C, 0
    end{filecontents*}

    begin{document}

    % read table data and sort
    pgfplotstableread[col sep=comma,columns={Abbreviation,percentage}]{topatributtes.csv}datatableA
    pgfplotstablesort[sort key={percentage}, sort cmp=int >]{datatablesorted}{datatableA}
    pgfplotstablegetrowsof{datatablesorted}
    pgfmathsetmacro{RowsInTable}{pgfplotsretval-1}

    begin{tikzpicture}
    begin{scope}
    tikzstyle{mypoligon} = [draw=none,regular polygon, rotate=-45,regular polygon sides=12]
    foreach x/y in {0.10625/a, 0.2125/b, 0.31875/c, 0.425/d, 0.53125/e, 0.6375/f, 0.74375/g}
    {
    node[mypoligon,minimum size=xtextwidth] (y) at (0,0) {};
    }
    foreach pol in {a,b,c,d,e,f,g}{
    foreach n [remember=n as lastn (initially 11)] in {1, 3, ..., 11} {
    path[draw=diagramgray] (pol.corner lastn) -- (pol.corner n);
    }
    }

    draw[diagramgray] (g.corner 1) -- (0,0) -- (g.corner 11) (0,0) -- (g.corner 7) (g.corner 5) -- (0,0);
    draw[fill=blue] circle [radius=1mm] {};


    % Draw abbreviation names in corners
    foreach k/a/x/y in {0/3/0/2, 1/1/2/2, 2/11/2/-1, 3/9/0/-2, 4/7/-2/-1, 5/5/-2/2}{
    pgfplotstablegetelem{k}{Abbreviation}of{datatablesorted}
    draw (g.corner a) node[xshift=x mm,yshift=y mm] (pgfplotsretval) {footnotesize textbf{pgfplotsretval}};
    pgfplotstablegetelem{k}{percentage}of{datatablesorted}

    % Draw lines from center to percentage value - this goes always to the max
    pgfmathtruncatemacro{itest}{pgfplotsretval>0}
    ifnumitest=1
    draw (0,0) -- (g.corner a) ;
    fi
    }

    foreach pol/i in {a/10,b/20,c/30,d/40,e/50,f/60,g/70}{
    draw (pol.corner 3) node[yshift=0.3]{fontsize{6pt}{10pt}selectfont color{textdarkgray}textsl{i}};
    }

    end{scope}
    end{tikzpicture}

    end{document}


    and this is how it looks like
    enter image description here



    My question is how can I scale the blue lines so they match the values from the table? Problem is that I have 8 polygons (nodes a-g) and range of values for each abbreviation can go from 0 to 70. Using ifthen command would take forever.. Thanks..









    share







    New contributor




    Almic7 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I need to draw a dynamic diagram that is based on the following table:



      Abbreviation Percentage
      A 70
      S 35
      C 0
      R 0
      E 0
      I 0


      and it needs to look like this
      enter image description here



      So far this is what I got



      documentclass{article}
      usepackage{graphicx}
      usepackage{xcolor}
      usepackage{color}
      usepackage{fancyhdr}
      usepackage{amsmath}
      usepackage{calc}
      usepackage{tikz}
      usetikzlibrary{spy}
      usetikzlibrary{fit,calc,positioning}
      usetikzlibrary{shapes.geometric}
      usetikzlibrary{arrows}
      usepackage{filecontents}
      usepackage{pgfplotstable}
      usepackage{ifthen}
      usepackage{etoolbox}
      usepackage{tabulary}
      usepackage{readarray}
      usepackage{array}



      definecolor{hashc}{HTML}{00A3E5}
      definecolor{diagramgray}{HTML}{D0D0D0}
      definecolor{textdarkgray}{HTML}{585858}

      begin{filecontents*}{topatributtes.csv}
      Abbreviation, percentage
      R, 0
      I, 0
      E, 0
      A, 70
      S, 35
      C, 0
      end{filecontents*}

      begin{document}

      % read table data and sort
      pgfplotstableread[col sep=comma,columns={Abbreviation,percentage}]{topatributtes.csv}datatableA
      pgfplotstablesort[sort key={percentage}, sort cmp=int >]{datatablesorted}{datatableA}
      pgfplotstablegetrowsof{datatablesorted}
      pgfmathsetmacro{RowsInTable}{pgfplotsretval-1}

      begin{tikzpicture}
      begin{scope}
      tikzstyle{mypoligon} = [draw=none,regular polygon, rotate=-45,regular polygon sides=12]
      foreach x/y in {0.10625/a, 0.2125/b, 0.31875/c, 0.425/d, 0.53125/e, 0.6375/f, 0.74375/g}
      {
      node[mypoligon,minimum size=xtextwidth] (y) at (0,0) {};
      }
      foreach pol in {a,b,c,d,e,f,g}{
      foreach n [remember=n as lastn (initially 11)] in {1, 3, ..., 11} {
      path[draw=diagramgray] (pol.corner lastn) -- (pol.corner n);
      }
      }

      draw[diagramgray] (g.corner 1) -- (0,0) -- (g.corner 11) (0,0) -- (g.corner 7) (g.corner 5) -- (0,0);
      draw[fill=blue] circle [radius=1mm] {};


      % Draw abbreviation names in corners
      foreach k/a/x/y in {0/3/0/2, 1/1/2/2, 2/11/2/-1, 3/9/0/-2, 4/7/-2/-1, 5/5/-2/2}{
      pgfplotstablegetelem{k}{Abbreviation}of{datatablesorted}
      draw (g.corner a) node[xshift=x mm,yshift=y mm] (pgfplotsretval) {footnotesize textbf{pgfplotsretval}};
      pgfplotstablegetelem{k}{percentage}of{datatablesorted}

      % Draw lines from center to percentage value - this goes always to the max
      pgfmathtruncatemacro{itest}{pgfplotsretval>0}
      ifnumitest=1
      draw (0,0) -- (g.corner a) ;
      fi
      }

      foreach pol/i in {a/10,b/20,c/30,d/40,e/50,f/60,g/70}{
      draw (pol.corner 3) node[yshift=0.3]{fontsize{6pt}{10pt}selectfont color{textdarkgray}textsl{i}};
      }

      end{scope}
      end{tikzpicture}

      end{document}


      and this is how it looks like
      enter image description here



      My question is how can I scale the blue lines so they match the values from the table? Problem is that I have 8 polygons (nodes a-g) and range of values for each abbreviation can go from 0 to 70. Using ifthen command would take forever.. Thanks..









      share







      New contributor




      Almic7 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I need to draw a dynamic diagram that is based on the following table:



      Abbreviation Percentage
      A 70
      S 35
      C 0
      R 0
      E 0
      I 0


      and it needs to look like this
      enter image description here



      So far this is what I got



      documentclass{article}
      usepackage{graphicx}
      usepackage{xcolor}
      usepackage{color}
      usepackage{fancyhdr}
      usepackage{amsmath}
      usepackage{calc}
      usepackage{tikz}
      usetikzlibrary{spy}
      usetikzlibrary{fit,calc,positioning}
      usetikzlibrary{shapes.geometric}
      usetikzlibrary{arrows}
      usepackage{filecontents}
      usepackage{pgfplotstable}
      usepackage{ifthen}
      usepackage{etoolbox}
      usepackage{tabulary}
      usepackage{readarray}
      usepackage{array}



      definecolor{hashc}{HTML}{00A3E5}
      definecolor{diagramgray}{HTML}{D0D0D0}
      definecolor{textdarkgray}{HTML}{585858}

      begin{filecontents*}{topatributtes.csv}
      Abbreviation, percentage
      R, 0
      I, 0
      E, 0
      A, 70
      S, 35
      C, 0
      end{filecontents*}

      begin{document}

      % read table data and sort
      pgfplotstableread[col sep=comma,columns={Abbreviation,percentage}]{topatributtes.csv}datatableA
      pgfplotstablesort[sort key={percentage}, sort cmp=int >]{datatablesorted}{datatableA}
      pgfplotstablegetrowsof{datatablesorted}
      pgfmathsetmacro{RowsInTable}{pgfplotsretval-1}

      begin{tikzpicture}
      begin{scope}
      tikzstyle{mypoligon} = [draw=none,regular polygon, rotate=-45,regular polygon sides=12]
      foreach x/y in {0.10625/a, 0.2125/b, 0.31875/c, 0.425/d, 0.53125/e, 0.6375/f, 0.74375/g}
      {
      node[mypoligon,minimum size=xtextwidth] (y) at (0,0) {};
      }
      foreach pol in {a,b,c,d,e,f,g}{
      foreach n [remember=n as lastn (initially 11)] in {1, 3, ..., 11} {
      path[draw=diagramgray] (pol.corner lastn) -- (pol.corner n);
      }
      }

      draw[diagramgray] (g.corner 1) -- (0,0) -- (g.corner 11) (0,0) -- (g.corner 7) (g.corner 5) -- (0,0);
      draw[fill=blue] circle [radius=1mm] {};


      % Draw abbreviation names in corners
      foreach k/a/x/y in {0/3/0/2, 1/1/2/2, 2/11/2/-1, 3/9/0/-2, 4/7/-2/-1, 5/5/-2/2}{
      pgfplotstablegetelem{k}{Abbreviation}of{datatablesorted}
      draw (g.corner a) node[xshift=x mm,yshift=y mm] (pgfplotsretval) {footnotesize textbf{pgfplotsretval}};
      pgfplotstablegetelem{k}{percentage}of{datatablesorted}

      % Draw lines from center to percentage value - this goes always to the max
      pgfmathtruncatemacro{itest}{pgfplotsretval>0}
      ifnumitest=1
      draw (0,0) -- (g.corner a) ;
      fi
      }

      foreach pol/i in {a/10,b/20,c/30,d/40,e/50,f/60,g/70}{
      draw (pol.corner 3) node[yshift=0.3]{fontsize{6pt}{10pt}selectfont color{textdarkgray}textsl{i}};
      }

      end{scope}
      end{tikzpicture}

      end{document}


      and this is how it looks like
      enter image description here



      My question is how can I scale the blue lines so they match the values from the table? Problem is that I have 8 polygons (nodes a-g) and range of values for each abbreviation can go from 0 to 70. Using ifthen command would take forever.. Thanks..







      tikz-pgf pgfplots





      share







      New contributor




      Almic7 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      Almic7 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      Almic7 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 5 mins ago









      Almic7Almic7

      32




      32




      New contributor




      Almic7 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Almic7 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Almic7 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          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
          });


          }
          });






          Almic7 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f487983%2fdynamic-plot-with-variable-line-length-from-csv-table%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








          Almic7 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Almic7 is a new contributor. Be nice, and check out our Code of Conduct.













          Almic7 is a new contributor. Be nice, and check out our Code of Conduct.












          Almic7 is a new contributor. Be nice, and check out our Code of Conduct.
















          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%2f487983%2fdynamic-plot-with-variable-line-length-from-csv-table%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

          Paper upload error, “Upload failed: The top margin is 0.715 in on page 3, which is below the required...

          Emraan Hashmi Filmografia | Linki zewnętrzne | Menu nawigacyjneGulshan GroverGulshan...

          How can I write this formula?newline and italics added with leqWhy does widehat behave differently if I...