Putting a vertical line in each Histogram using GraphicsGridWeird vertical line when trying to plot a...

Why write a book when there's a movie in my head?

Disk space full during insert, what happens?

Was Opportunity's last message to Earth "My battery is low and it's getting dark"?

Is it possible to detect 100% of SQLi with a simple regex?

Using Ansible, how can I take actions on each file in a specific location?

Why do single electrical receptacles exist?

Protagonist constantly has to have long words explained to her. Will this get tedious?

Is it really OK to use "because of"?

What happened to Hermione’s clothing and other possessions after she wiped her parents’ memories of her?

Are all power cords made equal?

Promise.all returning empty objects

How would an EMP effect spacesuits (and small-arms weapons)?

How to deal with an underperforming subordinate?

What is an explicit bijection in combinatorics?

Is there a way to pause a running process on Linux systems and resume later?

How to know if I am a 'Real Developer'

Was there a pre-determined arrangment for division of Germany in case it surrendered before any Soviet forces entered its territory?

Coworker is trying to get me to sign his petition to run for office. How to decline politely?

How can I prevent an oracle who can see into the past from knowing everything that has happened?

Is it possible to narrate a novel in a faux-historical style without alienating the reader?

Why is Shelob considered evil?

Did ancient Germans take pride in leaving the land untouched?

What could cause an entire planet of humans to become aphasic?

Visit to Paris in layover time, which visa?



Putting a vertical line in each Histogram using GraphicsGrid


Weird vertical line when trying to plot a histogramPlot and Histogram together in Mathematica 7Issue with combining weighted data log histogramsHow to compare Histogram Data?What happened with good old Histogram?Removing a histogram's vertical edgesHorizontal histogram axis and ticks positioningHow to do a parametric histogram?Histogram Bar Line ThicknessDrawing a vertical line at the mean of a bell curve













1












$begingroup$


I'm using GraphicsGrid to show several histograms.



In each histogram, I would like to show 2 vertical lines on the 2.5 and 97.5 percentiles. If I had an isolated histogram I would use Line, and Show. However, I have no idea how to proceed with a GraphicsGrid...










share|improve this question











$endgroup$












  • $begingroup$
    Could you just put your isolated-histogram solution in GraphicsGrid? It'd be easier to diagnose with some code...
    $endgroup$
    – Chris K
    3 hours ago
















1












$begingroup$


I'm using GraphicsGrid to show several histograms.



In each histogram, I would like to show 2 vertical lines on the 2.5 and 97.5 percentiles. If I had an isolated histogram I would use Line, and Show. However, I have no idea how to proceed with a GraphicsGrid...










share|improve this question











$endgroup$












  • $begingroup$
    Could you just put your isolated-histogram solution in GraphicsGrid? It'd be easier to diagnose with some code...
    $endgroup$
    – Chris K
    3 hours ago














1












1








1





$begingroup$


I'm using GraphicsGrid to show several histograms.



In each histogram, I would like to show 2 vertical lines on the 2.5 and 97.5 percentiles. If I had an isolated histogram I would use Line, and Show. However, I have no idea how to proceed with a GraphicsGrid...










share|improve this question











$endgroup$




I'm using GraphicsGrid to show several histograms.



In each histogram, I would like to show 2 vertical lines on the 2.5 and 97.5 percentiles. If I had an isolated histogram I would use Line, and Show. However, I have no idea how to proceed with a GraphicsGrid...







plotting graphics histograms






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 hours ago









m_goldberg

86.7k872196




86.7k872196










asked 3 hours ago









An old man in the sea.An old man in the sea.

1,052819




1,052819












  • $begingroup$
    Could you just put your isolated-histogram solution in GraphicsGrid? It'd be easier to diagnose with some code...
    $endgroup$
    – Chris K
    3 hours ago


















  • $begingroup$
    Could you just put your isolated-histogram solution in GraphicsGrid? It'd be easier to diagnose with some code...
    $endgroup$
    – Chris K
    3 hours ago
















$begingroup$
Could you just put your isolated-histogram solution in GraphicsGrid? It'd be easier to diagnose with some code...
$endgroup$
– Chris K
3 hours ago




$begingroup$
Could you just put your isolated-histogram solution in GraphicsGrid? It'd be easier to diagnose with some code...
$endgroup$
– Chris K
3 hours ago










2 Answers
2






active

oldest

votes


















2












$begingroup$

You can use GridLines combined with the option Method ->{"GridLinesInFront" -> True}:



{data1, data2} = RandomVariate[NormalDistribution[#, 1], 100] & /@ {2, 4};
GraphicsGrid[{Histogram[#, ImageSize -> 300,
GridLines -> {Thread[{Quantile[#, {.25, .975}],
Directive[Opacity[1], Thick, #] & /@ {Red, Blue}}], None},
Method -> {"GridLinesInFront" -> True}] & /@ {data1, data2}}]


enter image description here






share|improve this answer









$endgroup$





















    0












    $begingroup$

    Combining two sets of graphics objects with Show in a graphics grid is not difficult as long as the sets are compatible. That means, at least, all the objects in both lists should be plotted in the same coordinate system and have the same image size.



    Here is an example using some graphics I contrived.



    Draw random group of $n$ circles



    circles[n_] :=
    Module[{r, cntr},
    r := RandomReal[.25];
    cntr := RandomReal[1, {2}];
    Graphics[
    Table[{EdgeForm[Black], Hue[RandomReal[]], Disk[cntr, r]}, n],
    PlotRange -> {{0, 1}, {0, 1}},
    PlotRangeClipping -> True,
    Frame -> True]]


    Draw two random vertical lines with the left one red and the right one blue.



    lines[] :=
    Module[{lf, rt},
    lf := With[{x = RandomReal[.48]}, {Red, Line[{{x, 0}, {x, 1}}]}];
    rt := With[{x = RandomReal[{.52, 1}]}, {Blue, Line[{{x, 0}, {x, 1}}]}];
    Graphics[{lf, rt},
    PlotRange -> {{0, 1}, {0, 1}},
    PlotRangeClipping -> True,
    Frame -> True]]


    Now the following simple function will combined any two lists of graphics that are compatible in sense mentioned in the preamble to this answer. The rather elaborate argument patterns on the lefthand side of the SetDelayed expression represent my attempt to enforce the compatibility of the arguments.



    makeGrid[g1 : {_Graphics ..}, g2 : {_Graphics ..}, rows_Integer /; rows > 0] /; 
    Length[g1] == Length[g2] && Mod[Length[g1], rows] == 0 :=
    GraphicsGrid @ Apply[Show, Partition[Transpose[{g1, g2}], rows], {2}]


    So let's make a 4 x 4 graphics grid from a list of four circles groups and a list of four pairs of vertical lines.



    SeedRandom[4];
    makeGrid[Table[circles[8], 4], Table[lines[], 4], 2]


    grid






    share|improve this answer











    $endgroup$













      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',
      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%2f192106%2fputting-a-vertical-line-in-each-histogram-using-graphicsgrid%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









      2












      $begingroup$

      You can use GridLines combined with the option Method ->{"GridLinesInFront" -> True}:



      {data1, data2} = RandomVariate[NormalDistribution[#, 1], 100] & /@ {2, 4};
      GraphicsGrid[{Histogram[#, ImageSize -> 300,
      GridLines -> {Thread[{Quantile[#, {.25, .975}],
      Directive[Opacity[1], Thick, #] & /@ {Red, Blue}}], None},
      Method -> {"GridLinesInFront" -> True}] & /@ {data1, data2}}]


      enter image description here






      share|improve this answer









      $endgroup$


















        2












        $begingroup$

        You can use GridLines combined with the option Method ->{"GridLinesInFront" -> True}:



        {data1, data2} = RandomVariate[NormalDistribution[#, 1], 100] & /@ {2, 4};
        GraphicsGrid[{Histogram[#, ImageSize -> 300,
        GridLines -> {Thread[{Quantile[#, {.25, .975}],
        Directive[Opacity[1], Thick, #] & /@ {Red, Blue}}], None},
        Method -> {"GridLinesInFront" -> True}] & /@ {data1, data2}}]


        enter image description here






        share|improve this answer









        $endgroup$
















          2












          2








          2





          $begingroup$

          You can use GridLines combined with the option Method ->{"GridLinesInFront" -> True}:



          {data1, data2} = RandomVariate[NormalDistribution[#, 1], 100] & /@ {2, 4};
          GraphicsGrid[{Histogram[#, ImageSize -> 300,
          GridLines -> {Thread[{Quantile[#, {.25, .975}],
          Directive[Opacity[1], Thick, #] & /@ {Red, Blue}}], None},
          Method -> {"GridLinesInFront" -> True}] & /@ {data1, data2}}]


          enter image description here






          share|improve this answer









          $endgroup$



          You can use GridLines combined with the option Method ->{"GridLinesInFront" -> True}:



          {data1, data2} = RandomVariate[NormalDistribution[#, 1], 100] & /@ {2, 4};
          GraphicsGrid[{Histogram[#, ImageSize -> 300,
          GridLines -> {Thread[{Quantile[#, {.25, .975}],
          Directive[Opacity[1], Thick, #] & /@ {Red, Blue}}], None},
          Method -> {"GridLinesInFront" -> True}] & /@ {data1, data2}}]


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 2 hours ago









          kglrkglr

          185k10202421




          185k10202421























              0












              $begingroup$

              Combining two sets of graphics objects with Show in a graphics grid is not difficult as long as the sets are compatible. That means, at least, all the objects in both lists should be plotted in the same coordinate system and have the same image size.



              Here is an example using some graphics I contrived.



              Draw random group of $n$ circles



              circles[n_] :=
              Module[{r, cntr},
              r := RandomReal[.25];
              cntr := RandomReal[1, {2}];
              Graphics[
              Table[{EdgeForm[Black], Hue[RandomReal[]], Disk[cntr, r]}, n],
              PlotRange -> {{0, 1}, {0, 1}},
              PlotRangeClipping -> True,
              Frame -> True]]


              Draw two random vertical lines with the left one red and the right one blue.



              lines[] :=
              Module[{lf, rt},
              lf := With[{x = RandomReal[.48]}, {Red, Line[{{x, 0}, {x, 1}}]}];
              rt := With[{x = RandomReal[{.52, 1}]}, {Blue, Line[{{x, 0}, {x, 1}}]}];
              Graphics[{lf, rt},
              PlotRange -> {{0, 1}, {0, 1}},
              PlotRangeClipping -> True,
              Frame -> True]]


              Now the following simple function will combined any two lists of graphics that are compatible in sense mentioned in the preamble to this answer. The rather elaborate argument patterns on the lefthand side of the SetDelayed expression represent my attempt to enforce the compatibility of the arguments.



              makeGrid[g1 : {_Graphics ..}, g2 : {_Graphics ..}, rows_Integer /; rows > 0] /; 
              Length[g1] == Length[g2] && Mod[Length[g1], rows] == 0 :=
              GraphicsGrid @ Apply[Show, Partition[Transpose[{g1, g2}], rows], {2}]


              So let's make a 4 x 4 graphics grid from a list of four circles groups and a list of four pairs of vertical lines.



              SeedRandom[4];
              makeGrid[Table[circles[8], 4], Table[lines[], 4], 2]


              grid






              share|improve this answer











              $endgroup$


















                0












                $begingroup$

                Combining two sets of graphics objects with Show in a graphics grid is not difficult as long as the sets are compatible. That means, at least, all the objects in both lists should be plotted in the same coordinate system and have the same image size.



                Here is an example using some graphics I contrived.



                Draw random group of $n$ circles



                circles[n_] :=
                Module[{r, cntr},
                r := RandomReal[.25];
                cntr := RandomReal[1, {2}];
                Graphics[
                Table[{EdgeForm[Black], Hue[RandomReal[]], Disk[cntr, r]}, n],
                PlotRange -> {{0, 1}, {0, 1}},
                PlotRangeClipping -> True,
                Frame -> True]]


                Draw two random vertical lines with the left one red and the right one blue.



                lines[] :=
                Module[{lf, rt},
                lf := With[{x = RandomReal[.48]}, {Red, Line[{{x, 0}, {x, 1}}]}];
                rt := With[{x = RandomReal[{.52, 1}]}, {Blue, Line[{{x, 0}, {x, 1}}]}];
                Graphics[{lf, rt},
                PlotRange -> {{0, 1}, {0, 1}},
                PlotRangeClipping -> True,
                Frame -> True]]


                Now the following simple function will combined any two lists of graphics that are compatible in sense mentioned in the preamble to this answer. The rather elaborate argument patterns on the lefthand side of the SetDelayed expression represent my attempt to enforce the compatibility of the arguments.



                makeGrid[g1 : {_Graphics ..}, g2 : {_Graphics ..}, rows_Integer /; rows > 0] /; 
                Length[g1] == Length[g2] && Mod[Length[g1], rows] == 0 :=
                GraphicsGrid @ Apply[Show, Partition[Transpose[{g1, g2}], rows], {2}]


                So let's make a 4 x 4 graphics grid from a list of four circles groups and a list of four pairs of vertical lines.



                SeedRandom[4];
                makeGrid[Table[circles[8], 4], Table[lines[], 4], 2]


                grid






                share|improve this answer











                $endgroup$
















                  0












                  0








                  0





                  $begingroup$

                  Combining two sets of graphics objects with Show in a graphics grid is not difficult as long as the sets are compatible. That means, at least, all the objects in both lists should be plotted in the same coordinate system and have the same image size.



                  Here is an example using some graphics I contrived.



                  Draw random group of $n$ circles



                  circles[n_] :=
                  Module[{r, cntr},
                  r := RandomReal[.25];
                  cntr := RandomReal[1, {2}];
                  Graphics[
                  Table[{EdgeForm[Black], Hue[RandomReal[]], Disk[cntr, r]}, n],
                  PlotRange -> {{0, 1}, {0, 1}},
                  PlotRangeClipping -> True,
                  Frame -> True]]


                  Draw two random vertical lines with the left one red and the right one blue.



                  lines[] :=
                  Module[{lf, rt},
                  lf := With[{x = RandomReal[.48]}, {Red, Line[{{x, 0}, {x, 1}}]}];
                  rt := With[{x = RandomReal[{.52, 1}]}, {Blue, Line[{{x, 0}, {x, 1}}]}];
                  Graphics[{lf, rt},
                  PlotRange -> {{0, 1}, {0, 1}},
                  PlotRangeClipping -> True,
                  Frame -> True]]


                  Now the following simple function will combined any two lists of graphics that are compatible in sense mentioned in the preamble to this answer. The rather elaborate argument patterns on the lefthand side of the SetDelayed expression represent my attempt to enforce the compatibility of the arguments.



                  makeGrid[g1 : {_Graphics ..}, g2 : {_Graphics ..}, rows_Integer /; rows > 0] /; 
                  Length[g1] == Length[g2] && Mod[Length[g1], rows] == 0 :=
                  GraphicsGrid @ Apply[Show, Partition[Transpose[{g1, g2}], rows], {2}]


                  So let's make a 4 x 4 graphics grid from a list of four circles groups and a list of four pairs of vertical lines.



                  SeedRandom[4];
                  makeGrid[Table[circles[8], 4], Table[lines[], 4], 2]


                  grid






                  share|improve this answer











                  $endgroup$



                  Combining two sets of graphics objects with Show in a graphics grid is not difficult as long as the sets are compatible. That means, at least, all the objects in both lists should be plotted in the same coordinate system and have the same image size.



                  Here is an example using some graphics I contrived.



                  Draw random group of $n$ circles



                  circles[n_] :=
                  Module[{r, cntr},
                  r := RandomReal[.25];
                  cntr := RandomReal[1, {2}];
                  Graphics[
                  Table[{EdgeForm[Black], Hue[RandomReal[]], Disk[cntr, r]}, n],
                  PlotRange -> {{0, 1}, {0, 1}},
                  PlotRangeClipping -> True,
                  Frame -> True]]


                  Draw two random vertical lines with the left one red and the right one blue.



                  lines[] :=
                  Module[{lf, rt},
                  lf := With[{x = RandomReal[.48]}, {Red, Line[{{x, 0}, {x, 1}}]}];
                  rt := With[{x = RandomReal[{.52, 1}]}, {Blue, Line[{{x, 0}, {x, 1}}]}];
                  Graphics[{lf, rt},
                  PlotRange -> {{0, 1}, {0, 1}},
                  PlotRangeClipping -> True,
                  Frame -> True]]


                  Now the following simple function will combined any two lists of graphics that are compatible in sense mentioned in the preamble to this answer. The rather elaborate argument patterns on the lefthand side of the SetDelayed expression represent my attempt to enforce the compatibility of the arguments.



                  makeGrid[g1 : {_Graphics ..}, g2 : {_Graphics ..}, rows_Integer /; rows > 0] /; 
                  Length[g1] == Length[g2] && Mod[Length[g1], rows] == 0 :=
                  GraphicsGrid @ Apply[Show, Partition[Transpose[{g1, g2}], rows], {2}]


                  So let's make a 4 x 4 graphics grid from a list of four circles groups and a list of four pairs of vertical lines.



                  SeedRandom[4];
                  makeGrid[Table[circles[8], 4], Table[lines[], 4], 2]


                  grid







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 37 mins ago

























                  answered 47 mins ago









                  m_goldbergm_goldberg

                  86.7k872196




                  86.7k872196






























                      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%2f192106%2fputting-a-vertical-line-in-each-histogram-using-graphicsgrid%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

                      Szabolcs (Ungheria) Altri progetti | Menu di navigazione48°10′14.56″N 21°29′33.14″E /...

                      Discografia di Klaus Schulze Indice Album in studio | Album dal vivo | Singoli | Antologie | Colonne...

                      How to make inet_server_addr() return localhost in spite of ::1/128RETURN NEXT in Postgres FunctionConnect to...