Message Boards Message Boards

Change line Thickness in PlotStyle in Manipulate?

Posted 7 years ago

A simple question. How can I change the line thickness in PlotStyle in line with Manipulate?

If I change the PlotStyle->Thickness[0.01],{If[MemberQ[stats,30],True,None]........ it will not work properly.

Please can you help ?

Man29okt16 = {{0, 1}, {2.30, 2}, {3.55, 4}, {6.23, 4}, {6.35, 3}};
Man30okt16 = {{0, 4}, {2.39, 4}, {5.55, 4}, {7.15, 4}, {8.28, 
    4}, {9.14, 4}};
Man31okt16 = {{0, 2}, {2.38, 3}, {5.10, 3}, {6.08, 4}, {7.02, 
    4}, {7.52, 3}};
Man01nov16 = {{0, 3}, {3.27, 4}, {5.12, 3}, {5.38, 4}, {7.23, 3}};
Man02nov16 = {{0.0, 3}, {3.36, 3}, {5.05, 3}, {6.18, 3}, {8.05, 
    3}, {9.30, 3}, {9.55, 3}};
Man03nov16 = {{0.0, 1}, {3.54, 2}, {7.13, 3}};

Manipulate[ListPlot[
  {Man29okt16, Man30okt16, Man31okt16, Man01nov16, Man02nov16, 
   Man03nov16}
  , Joined -> True
  , PlotLabel -> Style["Title", Bold, 20]
  , BaseStyle -> {FontFamily -> "Helvetica", FontSize -> 9}
  , LabelStyle -> Directive[White, FontFamily -> "Helvetica", 15, Bold]
  , PlotLegends -> LineLegend[
    {"29okt16", "30okt16", "31okt16", "01nov16", "01nov16", "02nov16"}
    , LegendLayout -> (Grid[#, Spacings -> {1, .6}] &), 
    LegendLayout -> "Row"
    , LabelStyle -> Directive[Black, 10]]
  , GridLines -> {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, Automatic}
  , GridLinesStyle -> Directive[White, Dotted]
  , FrameTicks -> {{Automatic, 
     Automatic}, {{{0, "0:00"}, {1, "1:00"}, {2, "2:00"}, {3, 
       "3:00"}, {4, "4:00"}, {5, "5:00"}, {6, "6:00"}, {7, 
       "7:00"}, {8, "8:00"}, {9, "9:00"}, {10, "10:00"}}, Automatic}}
  , FrameStyle -> White
  , PlotRange -> {{0, 11}, {0, 4.3}}
  , Background -> Black
  , ImageMargins -> 1
  , FrameLabel -> {"Time", "Y-axis"}
  , Frame -> True
  , InterpolationOrder -> 0
  , ImageSize -> 500
  , PlotStyle ->
   {If[MemberQ[stats, 29], True, None]
    , If[MemberQ[stats, 30], True, None]
    , If[MemberQ[stats, 31], True, None]
    , If[MemberQ[stats, 01], True, None]
    , If[MemberQ[stats, 02], True, None]
    , If[MemberQ[stats, 03], True, None]
    }
  ],
 Row[{CheckboxBar[Dynamic[stats], {29, 30, 31, 01, 02, 03}]}]]
POSTED BY: Jos Klaps
4 Replies

Hi Neil,

Now everything works fine. Thanks a lot !

Best Regards,.......Jos

POSTED BY: Jos Klaps

Perhaps this is more proper way to set this up, but it potentially could be simplified further. Please note the different way to set up the Manipulate control.

Man29okt16={{0,1},{2.30,2},{3.55,4},{6.23,4},{6.35,3}};
Man30okt16={{0,4},{2.39,4},{5.55,4},{7.15,4},{8.28,4},{9.14,4}};
Man31okt16={{0,2},{2.38,3},{5.10,3},{6.08,4},{7.02,4},{7.52,3}};
Man01nov16={{0,3},{3.27,4},{5.12,3},{5.38,4},{7.23,3}};
Man02nov16={{0.0,3},{3.36,3},{5.05,3},{6.18,3},{8.05,3},{9.30,3},{9.55,3}};
Man03nov16={{0.0,1},{3.54,2},{7.13,3}};

Manipulate[
    ListPlot[{
       Man29okt16,Man30okt16,Man31okt16,
       Man01nov16,Man02nov16,Man03nov16},
    Joined->True,PlotLabel->Style["Title",Bold,20],
    BaseStyle->{FontFamily->"Helvetica",FontSize->9},
    LabelStyle->Directive[White,FontFamily->"Helvetica",15,Bold],
    PlotLegends->LineLegend[{"29okt16","30okt16","31okt16","01nov16","01nov16","02nov16"},
    LegendLayout->(Grid[#,Spacings->{1,.6}]&),LegendLayout->"Row",
    LabelStyle->Directive[Black,10]],GridLines->{{1,2,3,4,5,6,7,8,9,10,11,12},Automatic},
    GridLinesStyle->Directive[White,Dotted],
    FrameTicks->{
       {Automatic,Automatic},
       {{{0,"0:00"},{1,"1:00"},{2,"2:00"},{3,"3:00"},{4,"4:00"},{5,"5:00"},
       {6,"6:00"},{7,"7:00"},{8,"8:00"},{9,"9:00"},{10,"10:00"}},Automatic}},
    FrameStyle->White,PlotRange->{{0,11},{0,4.3}},Background->Black,ImageMargins->1,
    FrameLabel->{"Time","Y-axis"},Frame->True,InterpolationOrder->0,ImageSize->500,
    PlotStyle->{
       If[MemberQ[stats,29],Thickness[0.01],None],
       If[MemberQ[stats,30],Thickness[0.01],None],
       If[MemberQ[stats,31],Thickness[0.01],None],
       If[MemberQ[stats,01],Thickness[0.01],None],
       If[MemberQ[stats,02],Thickness[0.01],None],
       If[MemberQ[stats,03],Thickness[0.01],None]}],
{{stats,{29,31},"check"},{29,30,31,01,02,03},CheckboxBar}]
POSTED BY: Vitaliy Kaurov

Thanks to let me know and your excellent support !

Best Regards,....Jos

POSTED BY: Jos Klaps

This Works -- I added some extra params as well

PlotStyle -> {If[MemberQ[stats, 29], Thickness[.01], None], 
   If[MemberQ[stats, 30], {Thickness[.02], Opacity[.5]}, None], 
   If[MemberQ[stats, 31], True, None], 
   If[MemberQ[stats, 01], True, None], 
   If[MemberQ[stats, 02], True, None], 
   If[MemberQ[stats, 03], True, None]}]
POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract