How to graph multiple lines of the same color that each contain multi-colored points











up vote
4
down vote

favorite












I need to make a graph with multiple lines and points. Each line contains 3 points that should each be colored black, yellow, and red. The line should be a neutral gray.



I managed to create a graph that has those points without lines:



enter image description here



Graphics[
Table[{Text[
Style["•", Flatten[colors][[i]], Bold,
FontSize -> 20, FontFamily -> "Arial"],
data[[i]]]}, {i, 1, Length[data]}],
ImageSize -> {500, 500}, Frame -> True]


And a graph that has those points connected by a line but colored incorrectly:



enter image description here



 ListLinePlot[Partition[data, 3], PlotMarkers -> {"•", 20}]


The data:



data = {{-0.962001,0.397816},{-0.122007,-0.0413612},{-0.0544419,-0.214962},{-0.135477,0.571107},{0.899526,0.190296},{0.898588,0.00546919},{-0.347618,0.666652},{0.246898,0.498308},{0.374387,0.483023},{-0.581681,0.14916},{-0.0997349,-0.10738},{0.0364981,-0.261247},{0.768949,0.875527},{1.95692,0.436888},{1.95962,0.355918},{-1.25323,0.307325},{-0.411717,-0.163014},{-0.387259,-0.196534},{-0.419625,0.287503},{-0.0076809,0.131083},{-0.0899933,0.17461},{0.0317604,-0.0695526},{0.370543,-0.260739},{0.513008,-0.325415},{0.424957,-0.103409},{0.94739,-0.363821},{1.24866,-0.520327},{-1.13206,0.149609},{-0.174019,-0.957962},{0.150149,-1.12718},{-1.10439,0.151338},{0.08283,-1.0489},{0.437483,-1.23367},{-1.13195,0.180468},{0.22697,-1.22584},{0.564093,-1.32619},{-1.12527,0.144753},{-0.31816,-0.769721},{0.13676,-1.08828},{0.512897,0.615075},{1.60425,0.266658},{1.56731,0.157649},{1.07963,0.691473},{2.32712,0.251782},{2.24102,0.203162},{0.146878,0.550012},{0.920199,0.229813},{0.93112,0.105877},{-0.618883,0.288482},{-0.114264,0.0952308},{-0.0902663,-0.0274716},{-0.42587,0.26112},{0.0296797,0.134414},{0.234351,0.0977336},{0.149234,0.312535},{0.566986,0.146658},{0.729692,0.192777},{-0.797245,0.301785},{-0.405653,0.129507},{-0.399827,0.125799},{-0.986633,0.301104},{-0.423614,-0.0630775},{-0.179002,-0.258728},{-1.06393,0.294462},{-0.646153,-0.0180542},{-0.530922,-0.174294},{-1.3346,0.288987},{-0.855399,-0.0954821},{-0.603291,-0.291644},{-0.953345,0.34497},{0.0734577,-0.507661},{0.495145,-0.806878},{-1.39286,0.27325},{-1.04882,-0.0124537},{-0.86758,-0.177823},{-1.07263,0.189348},{-0.87054,0.0332001},{-0.709255,-0.055134},{-0.884372,-0.133042},{-0.715605,-0.278561},{-0.450264,-0.591745},{0.00174907,0.689063},{0.857285,0.343011},{0.841798,0.233118},{0.268577,0.56418},{1.30903,0.0808955},{1.34309,-0.0496938},{-0.442908,0.205066},{0.156048,-0.103125},{0.229659,-0.2128},{-0.769446,0.115635},{-0.718515,0.0678925},{-0.687545,0.0584056},{-0.107299,0.0528954},{0.0258309,-0.0434246},{0.106836,-0.143284}}

colors = ConstantArray[{Black, Yellow, Red}, Length[repeatedStrainLabels]/3]


How can I get a graph that contains a gray line for every 3 elements in data, with the 1st element being a black point on the line, 2nd yellow, and 3rd red?










share|improve this question


























    up vote
    4
    down vote

    favorite












    I need to make a graph with multiple lines and points. Each line contains 3 points that should each be colored black, yellow, and red. The line should be a neutral gray.



    I managed to create a graph that has those points without lines:



    enter image description here



    Graphics[
    Table[{Text[
    Style["•", Flatten[colors][[i]], Bold,
    FontSize -> 20, FontFamily -> "Arial"],
    data[[i]]]}, {i, 1, Length[data]}],
    ImageSize -> {500, 500}, Frame -> True]


    And a graph that has those points connected by a line but colored incorrectly:



    enter image description here



     ListLinePlot[Partition[data, 3], PlotMarkers -> {"•", 20}]


    The data:



    data = {{-0.962001,0.397816},{-0.122007,-0.0413612},{-0.0544419,-0.214962},{-0.135477,0.571107},{0.899526,0.190296},{0.898588,0.00546919},{-0.347618,0.666652},{0.246898,0.498308},{0.374387,0.483023},{-0.581681,0.14916},{-0.0997349,-0.10738},{0.0364981,-0.261247},{0.768949,0.875527},{1.95692,0.436888},{1.95962,0.355918},{-1.25323,0.307325},{-0.411717,-0.163014},{-0.387259,-0.196534},{-0.419625,0.287503},{-0.0076809,0.131083},{-0.0899933,0.17461},{0.0317604,-0.0695526},{0.370543,-0.260739},{0.513008,-0.325415},{0.424957,-0.103409},{0.94739,-0.363821},{1.24866,-0.520327},{-1.13206,0.149609},{-0.174019,-0.957962},{0.150149,-1.12718},{-1.10439,0.151338},{0.08283,-1.0489},{0.437483,-1.23367},{-1.13195,0.180468},{0.22697,-1.22584},{0.564093,-1.32619},{-1.12527,0.144753},{-0.31816,-0.769721},{0.13676,-1.08828},{0.512897,0.615075},{1.60425,0.266658},{1.56731,0.157649},{1.07963,0.691473},{2.32712,0.251782},{2.24102,0.203162},{0.146878,0.550012},{0.920199,0.229813},{0.93112,0.105877},{-0.618883,0.288482},{-0.114264,0.0952308},{-0.0902663,-0.0274716},{-0.42587,0.26112},{0.0296797,0.134414},{0.234351,0.0977336},{0.149234,0.312535},{0.566986,0.146658},{0.729692,0.192777},{-0.797245,0.301785},{-0.405653,0.129507},{-0.399827,0.125799},{-0.986633,0.301104},{-0.423614,-0.0630775},{-0.179002,-0.258728},{-1.06393,0.294462},{-0.646153,-0.0180542},{-0.530922,-0.174294},{-1.3346,0.288987},{-0.855399,-0.0954821},{-0.603291,-0.291644},{-0.953345,0.34497},{0.0734577,-0.507661},{0.495145,-0.806878},{-1.39286,0.27325},{-1.04882,-0.0124537},{-0.86758,-0.177823},{-1.07263,0.189348},{-0.87054,0.0332001},{-0.709255,-0.055134},{-0.884372,-0.133042},{-0.715605,-0.278561},{-0.450264,-0.591745},{0.00174907,0.689063},{0.857285,0.343011},{0.841798,0.233118},{0.268577,0.56418},{1.30903,0.0808955},{1.34309,-0.0496938},{-0.442908,0.205066},{0.156048,-0.103125},{0.229659,-0.2128},{-0.769446,0.115635},{-0.718515,0.0678925},{-0.687545,0.0584056},{-0.107299,0.0528954},{0.0258309,-0.0434246},{0.106836,-0.143284}}

    colors = ConstantArray[{Black, Yellow, Red}, Length[repeatedStrainLabels]/3]


    How can I get a graph that contains a gray line for every 3 elements in data, with the 1st element being a black point on the line, 2nd yellow, and 3rd red?










    share|improve this question
























      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      I need to make a graph with multiple lines and points. Each line contains 3 points that should each be colored black, yellow, and red. The line should be a neutral gray.



      I managed to create a graph that has those points without lines:



      enter image description here



      Graphics[
      Table[{Text[
      Style["•", Flatten[colors][[i]], Bold,
      FontSize -> 20, FontFamily -> "Arial"],
      data[[i]]]}, {i, 1, Length[data]}],
      ImageSize -> {500, 500}, Frame -> True]


      And a graph that has those points connected by a line but colored incorrectly:



      enter image description here



       ListLinePlot[Partition[data, 3], PlotMarkers -> {"•", 20}]


      The data:



      data = {{-0.962001,0.397816},{-0.122007,-0.0413612},{-0.0544419,-0.214962},{-0.135477,0.571107},{0.899526,0.190296},{0.898588,0.00546919},{-0.347618,0.666652},{0.246898,0.498308},{0.374387,0.483023},{-0.581681,0.14916},{-0.0997349,-0.10738},{0.0364981,-0.261247},{0.768949,0.875527},{1.95692,0.436888},{1.95962,0.355918},{-1.25323,0.307325},{-0.411717,-0.163014},{-0.387259,-0.196534},{-0.419625,0.287503},{-0.0076809,0.131083},{-0.0899933,0.17461},{0.0317604,-0.0695526},{0.370543,-0.260739},{0.513008,-0.325415},{0.424957,-0.103409},{0.94739,-0.363821},{1.24866,-0.520327},{-1.13206,0.149609},{-0.174019,-0.957962},{0.150149,-1.12718},{-1.10439,0.151338},{0.08283,-1.0489},{0.437483,-1.23367},{-1.13195,0.180468},{0.22697,-1.22584},{0.564093,-1.32619},{-1.12527,0.144753},{-0.31816,-0.769721},{0.13676,-1.08828},{0.512897,0.615075},{1.60425,0.266658},{1.56731,0.157649},{1.07963,0.691473},{2.32712,0.251782},{2.24102,0.203162},{0.146878,0.550012},{0.920199,0.229813},{0.93112,0.105877},{-0.618883,0.288482},{-0.114264,0.0952308},{-0.0902663,-0.0274716},{-0.42587,0.26112},{0.0296797,0.134414},{0.234351,0.0977336},{0.149234,0.312535},{0.566986,0.146658},{0.729692,0.192777},{-0.797245,0.301785},{-0.405653,0.129507},{-0.399827,0.125799},{-0.986633,0.301104},{-0.423614,-0.0630775},{-0.179002,-0.258728},{-1.06393,0.294462},{-0.646153,-0.0180542},{-0.530922,-0.174294},{-1.3346,0.288987},{-0.855399,-0.0954821},{-0.603291,-0.291644},{-0.953345,0.34497},{0.0734577,-0.507661},{0.495145,-0.806878},{-1.39286,0.27325},{-1.04882,-0.0124537},{-0.86758,-0.177823},{-1.07263,0.189348},{-0.87054,0.0332001},{-0.709255,-0.055134},{-0.884372,-0.133042},{-0.715605,-0.278561},{-0.450264,-0.591745},{0.00174907,0.689063},{0.857285,0.343011},{0.841798,0.233118},{0.268577,0.56418},{1.30903,0.0808955},{1.34309,-0.0496938},{-0.442908,0.205066},{0.156048,-0.103125},{0.229659,-0.2128},{-0.769446,0.115635},{-0.718515,0.0678925},{-0.687545,0.0584056},{-0.107299,0.0528954},{0.0258309,-0.0434246},{0.106836,-0.143284}}

      colors = ConstantArray[{Black, Yellow, Red}, Length[repeatedStrainLabels]/3]


      How can I get a graph that contains a gray line for every 3 elements in data, with the 1st element being a black point on the line, 2nd yellow, and 3rd red?










      share|improve this question













      I need to make a graph with multiple lines and points. Each line contains 3 points that should each be colored black, yellow, and red. The line should be a neutral gray.



      I managed to create a graph that has those points without lines:



      enter image description here



      Graphics[
      Table[{Text[
      Style["•", Flatten[colors][[i]], Bold,
      FontSize -> 20, FontFamily -> "Arial"],
      data[[i]]]}, {i, 1, Length[data]}],
      ImageSize -> {500, 500}, Frame -> True]


      And a graph that has those points connected by a line but colored incorrectly:



      enter image description here



       ListLinePlot[Partition[data, 3], PlotMarkers -> {"•", 20}]


      The data:



      data = {{-0.962001,0.397816},{-0.122007,-0.0413612},{-0.0544419,-0.214962},{-0.135477,0.571107},{0.899526,0.190296},{0.898588,0.00546919},{-0.347618,0.666652},{0.246898,0.498308},{0.374387,0.483023},{-0.581681,0.14916},{-0.0997349,-0.10738},{0.0364981,-0.261247},{0.768949,0.875527},{1.95692,0.436888},{1.95962,0.355918},{-1.25323,0.307325},{-0.411717,-0.163014},{-0.387259,-0.196534},{-0.419625,0.287503},{-0.0076809,0.131083},{-0.0899933,0.17461},{0.0317604,-0.0695526},{0.370543,-0.260739},{0.513008,-0.325415},{0.424957,-0.103409},{0.94739,-0.363821},{1.24866,-0.520327},{-1.13206,0.149609},{-0.174019,-0.957962},{0.150149,-1.12718},{-1.10439,0.151338},{0.08283,-1.0489},{0.437483,-1.23367},{-1.13195,0.180468},{0.22697,-1.22584},{0.564093,-1.32619},{-1.12527,0.144753},{-0.31816,-0.769721},{0.13676,-1.08828},{0.512897,0.615075},{1.60425,0.266658},{1.56731,0.157649},{1.07963,0.691473},{2.32712,0.251782},{2.24102,0.203162},{0.146878,0.550012},{0.920199,0.229813},{0.93112,0.105877},{-0.618883,0.288482},{-0.114264,0.0952308},{-0.0902663,-0.0274716},{-0.42587,0.26112},{0.0296797,0.134414},{0.234351,0.0977336},{0.149234,0.312535},{0.566986,0.146658},{0.729692,0.192777},{-0.797245,0.301785},{-0.405653,0.129507},{-0.399827,0.125799},{-0.986633,0.301104},{-0.423614,-0.0630775},{-0.179002,-0.258728},{-1.06393,0.294462},{-0.646153,-0.0180542},{-0.530922,-0.174294},{-1.3346,0.288987},{-0.855399,-0.0954821},{-0.603291,-0.291644},{-0.953345,0.34497},{0.0734577,-0.507661},{0.495145,-0.806878},{-1.39286,0.27325},{-1.04882,-0.0124537},{-0.86758,-0.177823},{-1.07263,0.189348},{-0.87054,0.0332001},{-0.709255,-0.055134},{-0.884372,-0.133042},{-0.715605,-0.278561},{-0.450264,-0.591745},{0.00174907,0.689063},{0.857285,0.343011},{0.841798,0.233118},{0.268577,0.56418},{1.30903,0.0808955},{1.34309,-0.0496938},{-0.442908,0.205066},{0.156048,-0.103125},{0.229659,-0.2128},{-0.769446,0.115635},{-0.718515,0.0678925},{-0.687545,0.0584056},{-0.107299,0.0528954},{0.0258309,-0.0434246},{0.106836,-0.143284}}

      colors = ConstantArray[{Black, Yellow, Red}, Length[repeatedStrainLabels]/3]


      How can I get a graph that contains a gray line for every 3 elements in data, with the 1st element being a black point on the line, 2nd yellow, and 3rd red?







      plotting graphics color






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 26 at 0:40









      briennakh

      4799




      4799






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          6
          down vote



          accepted










          ListPlot[List /@ data, PlotStyle -> {Black, Yellow, Red}, 
          BaseStyle -> PointSize[Large], Epilog -> {Gray, Line@Partition[data, 3]}]


          enter image description here



          Alternatively,



          ListPlot[Riffle[List /@ data, Partition[data, 3]], 
          Joined -> {False, True},
          PlotStyle -> Riffle[{Black, Yellow, Red}, Gray, {2, -1, 2}],
          BaseStyle -> PointSize[Large]]


          enter image description here






          share|improve this answer























          • Interesting use of Epilog. Thanks!
            – briennakh
            Nov 26 at 0:56


















          up vote
          2
          down vote













          Graphics[{Gray, Line@#, AbsolutePointSize[4], Black, Point[#[[1]]], 
          Yellow, Point[#[[2]]], Red, Point[#[[3]]]} & /@
          Partition[data, 3], Axes -> True]


          enter image description here






          share|improve this answer





















            Your Answer





            StackExchange.ifUsing("editor", function () {
            return StackExchange.using("mathjaxEditing", function () {
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            });
            });
            }, "mathjax-editing");

            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',
            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%2f186685%2fhow-to-graph-multiple-lines-of-the-same-color-that-each-contain-multi-colored-po%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            6
            down vote



            accepted










            ListPlot[List /@ data, PlotStyle -> {Black, Yellow, Red}, 
            BaseStyle -> PointSize[Large], Epilog -> {Gray, Line@Partition[data, 3]}]


            enter image description here



            Alternatively,



            ListPlot[Riffle[List /@ data, Partition[data, 3]], 
            Joined -> {False, True},
            PlotStyle -> Riffle[{Black, Yellow, Red}, Gray, {2, -1, 2}],
            BaseStyle -> PointSize[Large]]


            enter image description here






            share|improve this answer























            • Interesting use of Epilog. Thanks!
              – briennakh
              Nov 26 at 0:56















            up vote
            6
            down vote



            accepted










            ListPlot[List /@ data, PlotStyle -> {Black, Yellow, Red}, 
            BaseStyle -> PointSize[Large], Epilog -> {Gray, Line@Partition[data, 3]}]


            enter image description here



            Alternatively,



            ListPlot[Riffle[List /@ data, Partition[data, 3]], 
            Joined -> {False, True},
            PlotStyle -> Riffle[{Black, Yellow, Red}, Gray, {2, -1, 2}],
            BaseStyle -> PointSize[Large]]


            enter image description here






            share|improve this answer























            • Interesting use of Epilog. Thanks!
              – briennakh
              Nov 26 at 0:56













            up vote
            6
            down vote



            accepted







            up vote
            6
            down vote



            accepted






            ListPlot[List /@ data, PlotStyle -> {Black, Yellow, Red}, 
            BaseStyle -> PointSize[Large], Epilog -> {Gray, Line@Partition[data, 3]}]


            enter image description here



            Alternatively,



            ListPlot[Riffle[List /@ data, Partition[data, 3]], 
            Joined -> {False, True},
            PlotStyle -> Riffle[{Black, Yellow, Red}, Gray, {2, -1, 2}],
            BaseStyle -> PointSize[Large]]


            enter image description here






            share|improve this answer














            ListPlot[List /@ data, PlotStyle -> {Black, Yellow, Red}, 
            BaseStyle -> PointSize[Large], Epilog -> {Gray, Line@Partition[data, 3]}]


            enter image description here



            Alternatively,



            ListPlot[Riffle[List /@ data, Partition[data, 3]], 
            Joined -> {False, True},
            PlotStyle -> Riffle[{Black, Yellow, Red}, Gray, {2, -1, 2}],
            BaseStyle -> PointSize[Large]]


            enter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 26 at 1:05

























            answered Nov 26 at 0:54









            kglr

            175k9197402




            175k9197402












            • Interesting use of Epilog. Thanks!
              – briennakh
              Nov 26 at 0:56


















            • Interesting use of Epilog. Thanks!
              – briennakh
              Nov 26 at 0:56
















            Interesting use of Epilog. Thanks!
            – briennakh
            Nov 26 at 0:56




            Interesting use of Epilog. Thanks!
            – briennakh
            Nov 26 at 0:56










            up vote
            2
            down vote













            Graphics[{Gray, Line@#, AbsolutePointSize[4], Black, Point[#[[1]]], 
            Yellow, Point[#[[2]]], Red, Point[#[[3]]]} & /@
            Partition[data, 3], Axes -> True]


            enter image description here






            share|improve this answer

























              up vote
              2
              down vote













              Graphics[{Gray, Line@#, AbsolutePointSize[4], Black, Point[#[[1]]], 
              Yellow, Point[#[[2]]], Red, Point[#[[3]]]} & /@
              Partition[data, 3], Axes -> True]


              enter image description here






              share|improve this answer























                up vote
                2
                down vote










                up vote
                2
                down vote









                Graphics[{Gray, Line@#, AbsolutePointSize[4], Black, Point[#[[1]]], 
                Yellow, Point[#[[2]]], Red, Point[#[[3]]]} & /@
                Partition[data, 3], Axes -> True]


                enter image description here






                share|improve this answer












                Graphics[{Gray, Line@#, AbsolutePointSize[4], Black, Point[#[[1]]], 
                Yellow, Point[#[[2]]], Red, Point[#[[3]]]} & /@
                Partition[data, 3], Axes -> True]


                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 26 at 1:59









                Bob Hanlon

                58.3k23595




                58.3k23595






























                    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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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%2fmathematica.stackexchange.com%2fquestions%2f186685%2fhow-to-graph-multiple-lines-of-the-same-color-that-each-contain-multi-colored-po%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

                    Сан-Квентин

                    Алькесар

                    Josef Freinademetz