2
$\begingroup$

I have the following data:

points1 = {{643.5, 120.856}, {659.5, 120.856}, {627.5, 117.866}, {643.5, 117.866}, {659.5, 117.866}, {627.5, 114.876}, {643.5, 114.876}, {659.5, 114.876}, {627.5, 111.886}, {643.5, 111.886}, {659., 111.886}, {630., 98.9023}, {644.5, 97.8793}, {622., 96.935}, {679.5, 96.935}, {636.5, 95.9121}, {665.5, 95.9908}, {650.5, 94.8891}, {643., 92.9219}, {649.5, 90.0104}, {619.5, 88.9088}, {635.5, 88.9088}, {657.5, 87.9645}, {606., 86.9416}, {643., 86.9416}, {679.5, 86.9416}, {620.5, 85.9186}, {665.5, 85.9186}, {634.5, 84.9743}, {650.5, 84.9743}, {643.5, 82.9284}, {657.5, 80.9612}, {643.5, 79.9382}, {674.5, 77.8923}, {611.5, 76.9481}, {627.5, 76.9481}, {643.5, 76.9481}, {659.5, 76.9481}, {688.5, 76.9481}, {652., 74.9808}, {680.5, 74.9021}, {614., 73.9579}, {630., 73.9579}, {666.5, 73.9579}, {644.5, 73.0136}, {622.5, 71.912}, {658.5, 71.912}, {636.5, 70.9677}, {650.5, 70.0234}, {628.5, 68.9218}, {673.5, 68.9218}, {643., 67.9775}, {659., 67.9775}, {606.5, 64.9873}, {643., 64.9873}, {620.5, 63.9644}, {665.5, 64.0431}, {681.5, 64.0431}, {634.5, 62.9414}, {650.5, 62.9414}, {574.5, 61.0529}, {643., 60.9742}, {659., 60.9742}, {588.5, 59.9513}, {604.5, 59.9513}, {620.5, 59.9513}, {687.5, 59.9513}, {703.5, 59.9513}, {635., 59.007}, {651., 59.007}, {673., 59.007}, {620.5, 56.9611}, {643.5, 56.9611}, {665.5, 56.9611}, {582.5, 56.0168}, {703.5, 56.0168}, {597., 54.9939}, {612.5, 55.0725}, {628.5, 55.0725}, {657.5, 54.9939}, {673.5, 54.9939}, {689.5, 54.9939}, {643.5, 53.9709}, {635.5, 52.0037}, {649.5, 50.9807}, {611.5, 50.0364}, {627.5, 50.0364}, {672.5, 50.0364}, {642., 49.0135}, {658., 49.0135}, {649.5, 47.0463}, {672., 46.0233}, {619.5, 45.9446}, {635.5, 45.9446}, {657.5, 45.0004}, {643.5, 44.0561}, {606.5, 41.0659}, {679.5, 41.0659}, {620.5, 40.043}, {636.5, 40.043}, {665.5, 39.9643}, {598.5, 39.02}, {651., 39.02}, {687.5, 39.02}, {612.5, 38.0757}, {628.5, 38.0757}, {673.5, 38.0757}, {659., 37.0528}, {643.5, 36.9741}, {596.5, 35.0856}, {625.5, 35.0856}, {677.5, 35.0856}, {610.5, 33.9839}, {647.5, 33.9839}, {663.5, 33.9839}, {633., 33.0396}, {602.5, 32.0954}, {618.5, 32.0954}, {655., 32.0167}, {671., 32.0167}, {640.5, 30.9937}, {626.5, 30.0495}, {663., 30.0495}, {587.5, 29.1052}, {603.5, 29.1052}, {648.5, 29.0265}, {618.5, 28.0036}, {634.5, 28.0036}, {670.5, 28.0036}, {686.5, 28.0036}, {656.5, 27.0593}, {605., 26.0363}, {642., 26.0363}, {619.5, 25.0134}, {664.5, 25.0134}, {680.5, 25.0134}, {633.5, 24.0691}, {649.5, 24.0691}, {641.5, 22.0232}, {657.5, 22.0232}, {574.5, 21.0789}, {696., 21.0789}, {589., 20.056}, {605., 20.056}, {621., 20.056}, {649.5, 20.056}, {665.5, 20.056}, {681.5, 20.056}, {635.5, 19.033}, {657.5, 18.0887}, {643., 17.0658}, {604.5, 16.0428}, {620.5, 16.0428}, {681.5, 16.0428}, {634.5, 15.0986}, {650.5, 15.0986}, {666.5, 15.0986}, {611.5, 13.0527}, {627.5, 13.0527}, {643.5, 13.0527}, {665.5, 12.1084}, {635., 11.0854}, {651., 11.0854}, {643.5, 9.11821}, {659.5, 9.11821}, {695.5, 9.11821}, {604.5, 8.09526}, {620.5, 8.09526}, {681.5, 8.01657}, {635., 7.0723}, {651., 7.0723}, {667., 7.0723}, {590.5, 6.12803}, {689.5, 6.12803}, {605., 5.10508}, {621., 5.10508}, {659., 5.10508}, {675., 5.10508}, {643.5, 5.02639}, {628.5, 3.13786}, {643.5, 2.03621}, {659.5, 2.03621}}

points2F = {{390.5, 53.0779}, {390.5, 50.0782}, {406.5, 50.0782}, {390.5, 39.0268}, {404.5, 36.9744}, {390.5, 36.0271}, {398., 34.0537}, {376., 33.0275}, {420.5, 33.0275}, {390.5, 32.0802}, {406.5, 32.0802}, {442.5, 30.0278}, {351.5, 29.0805}, {367.5, 29.0805}, {383.5, 29.0805}, {412.5, 29.0805}, {428.5, 29.0805}, {398.5, 27.9754}, {360., 27.0281}, {375.5, 27.0281}, {420.5, 27.0281}, {436.5, 27.0281}, {390.5, 26.0809}, {406.5, 26.0809}, {367.5, 24.9757}, {382., 24.0285}, {398., 24.0285}, {414., 24.0285}, {374.5, 21.9761}, {390.5, 21.9761}, {406.5, 21.9761}, {422.5, 21.9761}, {345.5, 18.9764}, {390.5, 18.9764}, {442.5, 18.9764}, {359.5, 18.0291}, {375.5, 18.0291}, {412.5, 18.0291}, {428.5, 18.0291}, {398., 17.0029}, {383.5, 15.9767}, {420.5, 15.9767}, {345.5, 15.0295}, {361.5, 15.0295}, {405.5, 15.0295}, {434.5, 15.0295}, {375.5, 14.0033}, {391.5, 14.0033}, {337.5, 12.9771}, {353.5, 12.9771}, {426.5, 12.9771}, {442.5, 12.9771}, {479.5, 12.9771}, {315.5, 12.0298}, {367.5, 12.0298}, {383.5, 12.0298}, {412.5, 12.0298}, {465.5, 12.0298}, {329.5, 11.0036}, {345.5, 11.0036}, {398., 11.0036}, {435., 11.0036}, {451.,11.0036}, {291., 9.97739}, {360., 9.97739}, {375.5, 9.97739}, {420.5, 9.97739}, {305.5, 9.03012}, {321.5, 9.03012}, {337.5, 9.03012}, {390.5, 9.03012}, {406.5, 9.03012}, {442.5, 9.03012}, {458.5, 9.03012}, {474.5, 9.03012}, {490.5, 9.03012}, {351.5, 7.92498}, {428.5, 7.92498}, {366.5, 7.53029}, {281.5, 6.97772}, {298., 6.89878}, {382., 6.97772}, {400., 6.97772}, {414., 6.97772}, {483., 6.97772}, {499., 6.97772}, {307., 6.03046}, {328.167, 5.97783}, {343.5, 6.03046}, {360., 6.03046}, {436.5, 6.03046}, {425.5, 5.87258}, {460.5, 5.87258}, {392.5, 5.00425}, {422.5, 5.00425}, {289., 4.92532}, {374.5, 4.92532}, {406.5, 4.92532}, {490.5, 4.92532}, {303.5, 3.97805}, {319.5, 3.97805}, {335.5, 3.97805}, {351.5, 3.97805}, {444.5, 3.97805}, {460.5, 3.97805}, {476.5, 3.97805}, {366.5, 3.03079}, {382., 2.95185}, {398., 2.95185}, {414., 2.95185}, {430., 2.95185}, {280., 2.00459}, {296., 2.00459}, {484.5, 1.92565}, {500.5, 1.92565}, {326., 1.45202}, {310.5, 0.978386}, {342.5, 0.978386}, {358.5, 0.978386}, {374.5, 0.978386}, {390.5, 0.978386}, {406.5, 0.978386}, {422.5, 0.978386}, {438.5, 0.978386}, {454., 0.978386}, {470., 0.978386}, {469.316, 5.87258}, {451.684, 5.87258}, {402.352, 6.97772}, {393.462, 5.00425}, {365.018, 7.02116}, {301.611, 6.03046}, {326.5, 0.978386}}

points3 = {{374.277, 120.856}, {390.221, 120.856}, {406.164, 120.856}, {374.277, 117.866}, {390.221, 117.866}, {406.164, 117.866}, {374.277, 114.876}, {390.221, 114.876}, {406.164, 114.876}, {374.277, 111.886}, {390.221, 111.886}, {406.164, 111.886}}

with the corresponding plot:

ListPlot[{points1, points2F, points3}, Frame -> True, AspectRatio -> 1.2, GridLines -> {None, {20, 100}}, GridLinesStyle -> Directive[Black, Dashed], 
PlotStyle -> {{Green, PointSize[Large]}, {Green, PointSize[Large]}, {Red, PointSize[Large]}}, AxesOrigin -> {0, 0},
FrameTicks -> {{Append[Range[0, 100, 20], {120, ">100"}], None}, {Automatic, None}}]

enter image description here

Now, I need to make the frame of my plot to look like the following; but I don't know how to do it:

enter image description here

Specifically, I mean:

1. To remove the labels on the horizontal axis, and plot two lines below each of the two groups of points and write under the lines: 8 h p.i. and 16 h p.i.

2. To write low, medium, and high on the right side of the frame.

and in particular:

3. To cut the vertical axis above $100$ as in the figure in the above.

Any help is appreciated!

$\endgroup$

2 Answers 2

4
+50
$\begingroup$

This shows how to add a cut using ResourceFunction["PlotGrid"], see @GustavoDelfino's answer for the other stuff.

We first save the plot to a variable:

plot = ListPlot[{points1, points2F, points3}, Frame -> True, 
  AspectRatio -> 1.2, GridLines -> {None, {20, 100}}, 
  GridLinesStyle -> Directive[Black, Dashed], 
  PlotStyle -> {{Green, PointSize[Large]}, {Green, 
     PointSize[Large]}, {Red, PointSize[Large]}}, 
  AxesOrigin -> {0, 0}, 
  FrameTicks -> {{Append[Range[0, 100, 20], {120, ">100"}], 
     None}, {Automatic, None}}]

Now, using PlotGrid, we show the plot twice, and adjust the settings appropriately:

ResourceFunction["PlotGrid"][{
  {plot},
  {plot}
  },
 PlotRange -> {Inherited, {{{101, 125}, {0, 100}}}}, (* inherit the horizontal range, and set
                   the vertical ranges of the two plots to only show the appropriate parts *)
 "MergeAxes" -> "Cut", (* add the axis cut indicator *)
 ItemSize -> Scaled, (* adjust the two parts of the plot to have 
                        sizes according to the shown plot range *)
 Spacings -> 15, (* the gap between the plots, needed for the cut indicator to show up *)
 AspectRatio -> GoldenRatio (* set the overall aspect ratio *)
 ]

enter image description here

$\endgroup$
3
  • $\begingroup$ @Marteen Can you give a more concrete example of where the styles are different? If I add FrameStyle -> Directive[Black, 15] to the definition of plot, and add FrameLabel -> {"x label", "y label"} to the options of PlotGrid (as you tried), I get this result (notice how the styles are the same): Screenshot $\endgroup$
    – Lukas Lang
    Dec 14, 2022 at 20:20
  • 1
    $\begingroup$ @Marteen FrameStyle (as the name implies) changes the style of the frame. The Black colors font & lines black, the 15 is shorthand for FontSize->15. Directive is used to combine the two settings. What makes FrameStyle a bit "special" is that PlotGrid will copy the FrameStyle of the first plot for its own frame (which then controls the style of the labels specified for PlotGrid), see also the documentation of PlotGrid. You could of course also just specify FrameStyle->Directive[Black,15] in PlotGrid as well, but the other way makes sure everything looks the same. $\endgroup$
    – Lukas Lang
    Dec 14, 2022 at 21:39
  • 1
    $\begingroup$ @Marteen How are you adding the legend? If I use PlotLegends -> Placed[{"Experiment", None, "Simulation"}, {Left, Top}], the legend doesn't get moved unexpectedly. As for removing the second legend: You can use {{plot}, {First@plot}} as first argument to PlotGrid, this will explicitly strip off the legend from the second (lower) copy of plot, leaving you with this: Screenshot $\endgroup$
    – Lukas Lang
    Dec 15, 2022 at 9:48
3
$\begingroup$

The FrameTicks option can be further customized to help you get closer to your goal. For example try this in your code:

FrameTicks -> {
    {Append[Range[0, 100, 20], {120, ">100"}], 
    {{10,  Rotate["low", Pi/2], 0},
     {110, Rotate["high", Pi/2],0 }}},
    {{{Mean@points1[[All,  1]], "points1\nline2", 0},
      {Mean@points2F[[All, 1]], "points2F\nline 2", 0}},
    None}}

The broken axis are more difficult. Particularly on one side only. The easiest way is probably using the "MergeAxes" option of the PlotGrid resource function: https://resources.wolframcloud.com/FunctionRepository/resources/PlotGrid

UPDATE:

This addresses the additional concerns in your comments:

ListPlot[
    {points1,points2F,points3},
    Frame->True, AspectRatio->1.2, GridLines->{None,{20,100}},
    GridLinesStyle->Directive[Black,Dashed],
    PlotStyle->{{Green,PointSize[Large]},
                {Green,PointSize[Large]}, 
                {Red,PointSize[Large]}},
    AxesOrigin->{0,0},
    FrameTicks->{
        {Append[Range[0,100,20],{120,">100"}], 
         {{10,Rotate["low",Pi/2],0},
          {110,Rotate["high",Pi/2],0}}},
        With[{mean1=Mean@points2F[[All,1]],
              mean2=Mean@points1[[All,1]]},
            {{{mean1,"points2F",0},
              {Mean[{mean1,mean2}], 
               Column[{"",DisplayForm@OverscriptBox[Pane["some text",150,Alignment->Center],"\[UnderBrace]"]}],0},
              {mean2,"points1",0}},None}]},
    BaseStyle->{Larger,Bold}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Git it a try. I think you have the elements in my answer to achieve that goal. $\endgroup$ Dec 2, 2022 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.