Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Here's a second take:


    Code:
    label def Contesto2 1 a 2 b 3 c 5 a  6 b 7 c 9 a 10 b 11 c
    
    label val axis Contesto2 
    
    twoway `call' xaxis(1 2) xla(1 2 3 5 6 7 9 10 11, axis(2) noticks valuelabel labsize(medsmall)) legend(off) ytitle(Complex) xtitle("", axis(1)) xtitle("", axis(2)) yla(, ang(h)) xli(4 8, lw(vthin) lc(gs12))  xla(2 ".Pups" 6 "FF"  10 "aleF", noticks axis(1))

    Click image for larger version

Name:	multicolourbox2.png
Views:	1
Size:	43.8 KB
ID:	1588849

    Comment


    • #17
      THANKS A LOT..
      Another question: .Pups_a; FF_a; aleF_a ( same color but different shades)
      Pups_b; FF_b; aleF_b ( same color but different shades)
      Pups_c; FF_c; aleF_c ( same color but different shades)
      How can do it???

      Comment


      • #18
        thanks a lot!!!
        another question.
        i have to change the colour: Pups_a; FF_a; aleF_a ( same color but different shades)
        Pups_b; FF_b; aleF_b ( same color but different shades)
        Pups_c; FF_c; aleF_c ( same color but different shades)


        how can i do it???

        thanks a million

        Comment


        • #19
          sorry i write two times the same thing and i dont know why...

          Comment


          • #20
            i solved thanks a lot

            Comment


            • #21
              Dear Nick Cox
              ----------------------- copy starting from the next line -----------------------
              Code:
              * Example generated by -dataex-. To install: ssc install dataex
              clear
              input str8 OBS byte SUBJECT str3 STRAIN_old byte Pnd str5 STRAIN byte Nepisodesmin double Durations
              "ff1b6"     1 "B6"  2 "B6_2"   4    23
              "ff2b6"     2 "B6"  2 "B6_2"   3   3.7
              "ff3b6"     3 "B6"  2 "B6_2"   7   8.7
              "ff4b6"     4 "B6"  2 "B6_2"   9  31.1
              "ff6b6"     6 "B6"  2 "B6_2"   3   5.9
              "ff7b6"     7 "B6"  2 "B6_2"  16    33
              "ff8b6"     8 "B6"  2 "B6_2"   0     0
              "ff9b6"     9 "B6"  2 "B6_2"  11  30.6
              "ff10b6"   10 "B6"  2 "B6_2"  12  23.1
              "ff11b6"   11 "B6"  2 "B6_2"  11  35.7
              "ff12b6"   12 "B6"  2 "B6_2"   4   5.9
              "ff14b6"   14 "B6"  2 "B6_2"  12  29.9
              "ff2fvb"    2 "FVB" 2 "FVB_2" 21 126.8
              "ff3fvb"    3 "FVB" 2 "FVB_2" 25  70.1
              "ff4fvb"    4 "FVB" 2 "FVB_2" 27  78.3
              "ff5fvb"    5 "FVB" 2 "FVB_2" 20 121.5
              "ff6fvb"    6 "FVB" 2 "FVB_2" 25  82.4
              "ff7fvb"    7 "FVB" 2 "FVB_2" 20 103.5
              "ff8fvb"    8 "FVB" 2 "FVB_2" 29 108.5
              "ff9fvb"    9 "FVB" 2 "FVB_2" 36  97.9
              "ff10fvb"  10 "FVB" 2 "FVB_2"  8  47.3
              "ff11fvb"  11 "FVB" 2 "FVB_2" 26  98.1
              "ff12fvb"  12 "FVB" 2 "FVB_2" 30  95.8
              "ff13bfvb" 13 "FVB" 2 "FVB_2" 24  79.8
              "ff1cd1"    1 "CD1" 2 "CD1_2" 19  65.3
              "ff2cd1"    2 "CD1" 2 "CD1_2" 33 109.8
              "ff3cd1"    3 "CD1" 2 "CD1_2" 21 108.5
              "ff4cd1"    4 "CD1" 2 "CD1_2" 24    51
              "ff5cd1"    5 "CD1" 2 "CD1_2" 28  90.3
              "ff6cd1"    6 "CD1" 2 "CD1_2" 16  47.7
              "ff7cd1"    7 "CD1" 2 "CD1_2" 27  78.6
              "ff8cd1"    8 "CD1" 2 "CD1_2" 24 140.4
              "ff10cd1"  10 "CD1" 2 "CD1_2" 11  28.5
              "ff12cd1"  12 "CD1" 2 "CD1_2" 13  36.1
              "ff13cd1"  13 "CD1" 2 "CD1_2" 21  64.7
              "ff14cd1"  14 "CD1" 2 "CD1_2" 26  84.7
              "ff1b6"     1 "B6"  4 "B6_4"   5  19.1
              "ff2b6"     2 "B6"  4 "B6_4"  10  21.2
              "ff3b6"     3 "B6"  4 "B6_4"   9    10
              "ff4b6"     4 "B6"  4 "B6_4"  14  31.7
              "ff6b6"     6 "B6"  4 "B6_4"   5  13.4
              "ff7b6"     7 "B6"  4 "B6_4"  28  82.4
              "ff8b6"     8 "B6"  4 "B6_4"   0     0
              "ff9b6"     9 "B6"  4 "B6_4"   4  11.6
              "ff10b6"   10 "B6"  4 "B6_4"   6   8.5
              "ff11b6"   11 "B6"  4 "B6_4"   8  11.9
              "ff12b6"   12 "B6"  4 "B6_4"   7  16.3
              "ff14b6"   14 "B6"  4 "B6_4"  12  39.6
              "ff2fvb"    2 "FVB" 4 "FVB_4" 19  31.5
              "ff3fvb"    3 "FVB" 4 "FVB_4" 23  40.6
              "ff4fvb"    4 "FVB" 4 "FVB_4" 30  64.8
              "ff5fvb"    5 "FVB" 4 "FVB_4" 19  34.8
              "ff6fvb"    6 "FVB" 4 "FVB_4" 30  74.4
              "ff7fvb"    7 "FVB" 4 "FVB_4" 18  38.6
              "ff8fvb"    8 "FVB" 4 "FVB_4" 31  65.5
              "ff9fvb"    9 "FVB" 4 "FVB_4" 36  53.8
              "ff10fvb"  10 "FVB" 4 "FVB_4" 12  32.8
              "ff11fvb"  11 "FVB" 4 "FVB_4" 26  55.9
              "ff12fvb"  12 "FVB" 4 "FVB_4" 30  64.5
              "ff13bfvb" 13 "FVB" 4 "FVB_4" 20  29.7
              "ff1cd1"    1 "CD1" 4 "CD1_4" 13  14.5
              "ff2cd1"    2 "CD1" 4 "CD1_4" 20  28.3
              "ff3cd1"    3 "CD1" 4 "CD1_4" 18  21.5
              "ff4cd1"    4 "CD1" 4 "CD1_4" 24  26.9
              "ff5cd1"    5 "CD1" 4 "CD1_4" 29  54.3
              "ff6cd1"    6 "CD1" 4 "CD1_4" 13  15.7
              "ff7cd1"    7 "CD1" 4 "CD1_4" 32  84.5
              "ff8cd1"    8 "CD1" 4 "CD1_4" 17  19.5
              "ff10cd1"  10 "CD1" 4 "CD1_4" 12  17.4
              "ff12cd1"  12 "CD1" 4 "CD1_4" 16  20.3
              "ff13cd1"  13 "CD1" 4 "CD1_4" 17  36.7
              "ff14cd1"  14 "CD1" 4 "CD1_4" 14  19.8
              "ff1b6"     1 "B6"  6 "B6_6"   3   4.9
              "ff2b6"     2 "B6"  6 "B6_6"   1    .6
              "ff3b6"     3 "B6"  6 "B6_6"   2   2.6
              "ff4b6"     4 "B6"  6 "B6_6"   3   7.9
              "ff6b6"     6 "B6"  6 "B6_6"   2   2.3
              "ff7b6"     7 "B6"  6 "B6_6"   6   7.3
              "ff8b6"     8 "B6"  6 "B6_6"   0     0
              "ff9b6"     9 "B6"  6 "B6_6"   0     0
              "ff10b6"   10 "B6"  6 "B6_6"   1    .8
              "ff11b6"   11 "B6"  6 "B6_6"   2   1.2
              "ff12b6"   12 "B6"  6 "B6_6"   1    .3
              "ff14b6"   14 "B6"  6 "B6_6"   2   4.1
              "ff2fvb"    2 "FVB" 6 "FVB_6"  3   4.4
              "ff3fvb"    3 "FVB" 6 "FVB_6"  3   4.5
              "ff4fvb"    4 "FVB" 6 "FVB_6"  4   5.8
              "ff5fvb"    5 "FVB" 6 "FVB_6"  8   7.6
              "ff6fvb"    6 "FVB" 6 "FVB_6"  8   7.7
              "ff7fvb"    7 "FVB" 6 "FVB_6"  3   4.6
              "ff8fvb"    8 "FVB" 6 "FVB_6"  3     4
              "ff9fvb"    9 "FVB" 6 "FVB_6"  3     2
              "ff10fvb"  10 "FVB" 6 "FVB_6"  3   6.5
              "ff11fvb"  11 "FVB" 6 "FVB_6"  5     9
              "ff12fvb"  12 "FVB" 6 "FVB_6"  2   8.4
              "ff13bfvb" 13 "FVB" 6 "FVB_6"  5   6.3
              "ff1cd1"    1 "CD1" 6 "CD1_6"  3     2
              "ff2cd1"    2 "CD1" 6 "CD1_6"  1     2
              "ff3cd1"    3 "CD1" 6 "CD1_6"  3   2.1
              "ff4cd1"    4 "CD1" 6 "CD1_6" 17  24.7
              end
              ------------------ copy up to and including the previous line ------------------

              The syntax I wrote (you help me)

              label def order 1 B6 2 FVB 3 CD1
              encode STRAIN_old, gen(order) label(order)
              sort Pnd order
              gen axis = sum(Pnd != Pnd[_n-1]) + sum(order != order[_n-1]) - 1

              /*labmask axis, values(Strain_old)*/

              set scheme s1color

              bysort STRAIN: egen med = median(Nepisodesmin)
              by STRAIN: egen lqt = pctile(Nepisodesmin), p(25)
              by STRAIN: egen uqt = pctile(Nepisodesmin), p(75)

              local colours gray blue green
              local colours gray*0.5 blue*0.5 green*0.5 gray*0.5 blue*0.5 green*0.5 gray*0.5 blue*0.5 green*0.5
              local Colours gray blue green gray blue green gray blue green

              foreach value in B6 FVB CD1 {
              gettoken colour colours : colours
              local call `call' || rbar lqt med axis if STRAIN_old == "`value'", barw(0.6) fcolor(none) lcolor(`colour') ///
              || rbar uqt med axis if STRAIN_old == "`value'", barw(0.6) fcolor(none) lcolor(`colour') ///
              || scatter Nepisodesmin axis if STRAIN_old == "`value'", mc(`colour') ms(Oh)
              }

              twoway `call' xla(1/3 5/7 9/11, labsize(small) noticks valuelabel) legend(off) ytitle(N episodes / min) xtitle("") yla(, ang(h)) xli(4(4)16, lw(vthin) lc(gs12)) ///
              xmla(2 "Anogenital" 6 "Body" 10 "Head", tlength(*7) tlc(none) labsize(small)) yla(, ang(h))



              If i want to obtain also the box colour what could I do?

              Comment


              • #22
                Sorry, but I don't understand #21. The box colour is something you assign in your code. ,

                Comment


                • #23
                  Good morning Nick Cox
                  I mean, to obtain the whole colored box, not just the outline of the box.

                  Thanks a million

                  Comment


                  • #24

                    IT'S CLEAR NOW WHAT I MEAN #21? THANK YOU SO MUCH Nick Cox

                    Comment


                    • #25
                      Is anybody con help me please!!!

                      Comment


                      • #26
                        IT'S CLEAR NOW WHAT I MEAN #21? THANK YOU SO MUCH Nick Cox

                        Comment


                        • #27
                          You can vary fcolor() and lcolor() independently.

                          Comment


                          • #28
                            i try but i failed

                            in the syntax below
                            label def order 1 B6 2 FVB 3 CD1
                            encode STRAIN_old, gen(order) label(order)
                            sort Pnd order
                            gen axis = sum(Pnd != Pnd[_n-1]) + sum(order != order[_n-1]) - 1

                            /*labmask axis, values(Strain_old)*/

                            set scheme s1color

                            bysort STRAIN: egen med = median(Nepisodesmin)
                            by STRAIN: egen lqt = pctile(Nepisodesmin), p(25)
                            by STRAIN: egen uqt = pctile(Nepisodesmin), p(75)

                            local colours gray blue green
                            local colours gray*0.5 blue*0.5 green*0.5 gray*0.5 blue*0.5 green*0.5 gray*0.5 blue*0.5 green*0.5
                            local Colours gray blue green gray blue green gray blue green

                            foreach value in B6 FVB CD1 {
                            gettoken colour colours : colours
                            local call `call' || rbar lqt med axis if STRAIN_old == "`value'", barw(0.6) fcolor(none) lcolor(`colour') ///
                            || rbar uqt med axis if STRAIN_old == "`value'", barw(0.6) fcolor(none) lcolor(`colour') ///
                            || scatter Nepisodesmin axis if STRAIN_old == "`value'", mc(`colour') ms(Oh)
                            }

                            twoway `call' xla(1/3 5/7 9/11, labsize(small) noticks valuelabel) legend(off) ytitle(N episodes / min) xtitle("") yla(, ang(h)) xli(4(4)16, lw(vthin) lc(gs12)) ///
                            xmla(2 "Anogenital" 6 "Body" 10 "Head", tlength(*7) tlc(none) labsize(small)) yla(, ang(h))



                            What can i write? please help me @Ninck COx

                            Comment


                            • #29
                              please help m Nick Cox
                              I TRYED BUT I FAILED

                              Comment


                              • #30
                                As in #14

                                Note that you can edit a post within one hour of first posting.
                                There is no need for all these little posts.

                                Also. TYPING ALL CAPS IS CONSIDERED TO BE SHOUTING, so please don't do it.

                                The answer to #28 is already given in #14 if you study the code carefully.

                                Comment

                                Working...
                                X