Use custom image icons in ArrayPlot?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I would like to do an ArrayPlot where, instead of using colors, I can place my own custom images.



I tried something like ArrayPlot[0,1,0,1, ColorRules->0->img1, 1->img2], but it looks like some sort of average of the image is taken, which is then used as the color.



Is it possible to do this?










share|improve this question

























    up vote
    3
    down vote

    favorite












    I would like to do an ArrayPlot where, instead of using colors, I can place my own custom images.



    I tried something like ArrayPlot[0,1,0,1, ColorRules->0->img1, 1->img2], but it looks like some sort of average of the image is taken, which is then used as the color.



    Is it possible to do this?










    share|improve this question























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I would like to do an ArrayPlot where, instead of using colors, I can place my own custom images.



      I tried something like ArrayPlot[0,1,0,1, ColorRules->0->img1, 1->img2], but it looks like some sort of average of the image is taken, which is then used as the color.



      Is it possible to do this?










      share|improve this question













      I would like to do an ArrayPlot where, instead of using colors, I can place my own custom images.



      I tried something like ArrayPlot[0,1,0,1, ColorRules->0->img1, 1->img2], but it looks like some sort of average of the image is taken, which is then used as the color.



      Is it possible to do this?







      plotting






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      theQman

      1682




      1682




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          You can use GraphicsGrid:



          img1, img2 = ExampleData["TestImage", #] & /@ "Lena", "Mandrill";
          GraphicsGrid[RandomInteger[1, 5, 5] /. 0 -> img1, 1 -> img2, Spacings -> 0]


          enter image description here



          Or replace array entries with ImageData of input images, ArrayFlatten the resulting nested array and use Image on the result:



          SeedRandom[1]
          mat = RandomInteger[1, 5, 5];
          Image[ArrayFlatten[mat /. 0 -> ImageData[img1], 1 -> ImageData[img2]]] //
          ImageResize[#, 300] &


          enter image description here






          share|improve this answer



























            up vote
            1
            down vote













            You can also use Multicolumn



            img1, img2 = ExampleData["TestImage", #] & /@ "Lena", "Mandrill";
            Multicolumn[RandomInteger[1, 16] /. 0 -> img1, 1 -> img2,
            Spacings -> 0, 0]


            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: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              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%2f184872%2fuse-custom-image-icons-in-arrayplot%23new-answer', 'question_page');

              );

              Post as a guest






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              2
              down vote



              accepted










              You can use GraphicsGrid:



              img1, img2 = ExampleData["TestImage", #] & /@ "Lena", "Mandrill";
              GraphicsGrid[RandomInteger[1, 5, 5] /. 0 -> img1, 1 -> img2, Spacings -> 0]


              enter image description here



              Or replace array entries with ImageData of input images, ArrayFlatten the resulting nested array and use Image on the result:



              SeedRandom[1]
              mat = RandomInteger[1, 5, 5];
              Image[ArrayFlatten[mat /. 0 -> ImageData[img1], 1 -> ImageData[img2]]] //
              ImageResize[#, 300] &


              enter image description here






              share|improve this answer
























                up vote
                2
                down vote



                accepted










                You can use GraphicsGrid:



                img1, img2 = ExampleData["TestImage", #] & /@ "Lena", "Mandrill";
                GraphicsGrid[RandomInteger[1, 5, 5] /. 0 -> img1, 1 -> img2, Spacings -> 0]


                enter image description here



                Or replace array entries with ImageData of input images, ArrayFlatten the resulting nested array and use Image on the result:



                SeedRandom[1]
                mat = RandomInteger[1, 5, 5];
                Image[ArrayFlatten[mat /. 0 -> ImageData[img1], 1 -> ImageData[img2]]] //
                ImageResize[#, 300] &


                enter image description here






                share|improve this answer






















                  up vote
                  2
                  down vote



                  accepted







                  up vote
                  2
                  down vote



                  accepted






                  You can use GraphicsGrid:



                  img1, img2 = ExampleData["TestImage", #] & /@ "Lena", "Mandrill";
                  GraphicsGrid[RandomInteger[1, 5, 5] /. 0 -> img1, 1 -> img2, Spacings -> 0]


                  enter image description here



                  Or replace array entries with ImageData of input images, ArrayFlatten the resulting nested array and use Image on the result:



                  SeedRandom[1]
                  mat = RandomInteger[1, 5, 5];
                  Image[ArrayFlatten[mat /. 0 -> ImageData[img1], 1 -> ImageData[img2]]] //
                  ImageResize[#, 300] &


                  enter image description here






                  share|improve this answer












                  You can use GraphicsGrid:



                  img1, img2 = ExampleData["TestImage", #] & /@ "Lena", "Mandrill";
                  GraphicsGrid[RandomInteger[1, 5, 5] /. 0 -> img1, 1 -> img2, Spacings -> 0]


                  enter image description here



                  Or replace array entries with ImageData of input images, ArrayFlatten the resulting nested array and use Image on the result:



                  SeedRandom[1]
                  mat = RandomInteger[1, 5, 5];
                  Image[ArrayFlatten[mat /. 0 -> ImageData[img1], 1 -> ImageData[img2]]] //
                  ImageResize[#, 300] &


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 1 hour ago









                  kglr

                  168k8191394




                  168k8191394




















                      up vote
                      1
                      down vote













                      You can also use Multicolumn



                      img1, img2 = ExampleData["TestImage", #] & /@ "Lena", "Mandrill";
                      Multicolumn[RandomInteger[1, 16] /. 0 -> img1, 1 -> img2,
                      Spacings -> 0, 0]


                      enter image description here






                      share|improve this answer
























                        up vote
                        1
                        down vote













                        You can also use Multicolumn



                        img1, img2 = ExampleData["TestImage", #] & /@ "Lena", "Mandrill";
                        Multicolumn[RandomInteger[1, 16] /. 0 -> img1, 1 -> img2,
                        Spacings -> 0, 0]


                        enter image description here






                        share|improve this answer






















                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          You can also use Multicolumn



                          img1, img2 = ExampleData["TestImage", #] & /@ "Lena", "Mandrill";
                          Multicolumn[RandomInteger[1, 16] /. 0 -> img1, 1 -> img2,
                          Spacings -> 0, 0]


                          enter image description here






                          share|improve this answer












                          You can also use Multicolumn



                          img1, img2 = ExampleData["TestImage", #] & /@ "Lena", "Mandrill";
                          Multicolumn[RandomInteger[1, 16] /. 0 -> img1, 1 -> img2,
                          Spacings -> 0, 0]


                          enter image description here







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 24 mins ago









                          Okkes Dulgerci

                          3,3861716




                          3,3861716



























                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f184872%2fuse-custom-image-icons-in-arrayplot%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Comments

                              Popular posts from this blog

                              Long meetings (6-7 hours a day): Being “babysat” by supervisor

                              What does second last employer means? [closed]

                              One-line joke