Announcement

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

  • floatplot -legend- option

    Dear Nick Cox , I have started using your -floatplot- from SSC program. I really like to use it more extensively. But I wonder about the legend-options behaviour.
    This is what I see in your ado (-vertical-option not used):
    Code:
     legend(order(`legend') row(1) pos(6))
    Is there a good reason about this setting?

    If I want to tweak the -legend-options I get not reliable results. E.g. if I add
    Code:
    legend(col(1) pos(5))
    to the -floatplot- command I get the legend at "row(1) pos(6)" and not my change.


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte(jahr finr) double fi_
    4 1 2296399
    4 2  115000
    4 3 1488100
    4 4  484899
    4 5  459300
    4 6  423200
    4 7  132200
    4 8  595900
    3 1 2002099
    3 2  108300
    3 3 1483100
    3 4  406399
    3 5  341900
    3 6  356699
    3 7  136300
    3 8  694099
    2 1 1743699
    2 2   78000
    2 3 1252200
    2 4  357399
    2 5  288700
    2 6  303099
    2 7  115600
    2 8  586099
    5 1 2333000
    5 2   77500
    5 3 1698299
    5 4  480500
    5 5  417900
    5 6  493900
    5 7  203800
    5 8  729200
    6 1 2971799
    6 2   60600
    6 3 2051000
    6 4  549300
    6 5  439899
    6 6  596700
    6 7  153099
    6 8  610900
    1 1       0
    1 2       0
    1 3       0
    1 4       0
    1 5       0
    1 6       0
    1 7       0
    1 8       0
    end
    label values jahr jahr
    label def jahr 1 "2024", modify
    label def jahr 2 "2057", modify
    label def jahr 3 "2080", modify
    label def jahr 4 "2113", modify
    label def jahr 5 "2146", modify
    label def jahr 6 "2179", modify
    label values finr l_finr
    label def l_finr 1 "Ein", modify
    label def l_finr 2 "Foz", modify
    label def l_finr 3 "So", modify
    label def l_finr 4 "Schw", modify
    label def l_finr 5 "Fo", modify
    label def l_finr 6 "Gra", modify
    label def l_finr 7 "Gr", modify
    label def l_finr 8 "Ex", modify
    My command is based on the second example in the helpfile:
    Code:
    floatplot finr [fw=fi_], centre(3) fcolors(gs6 green orange bluishgray maroon blue yellow purple)  over(jahr) note("% zentriert auf So" "Quelle:", span) name(float_fi, replace) legend(col(1) pos(5)) xtitle("") ytitle("")


  • #2
    Okay, I tweaked legend-options to
    Code:
    legend(col(1) row(8) pos(4))
    and that works for me at the moment.
    So I learned that I need to use the legend-row-option in order to tweak the legend when in the non-vertical-option mode.

    Comment


    • #3
      Good that you solved your problem.

      The default for floatplot legends is just what is and probably grows out of what worked well for my own examples. Oddly, or otherwise, I can't find a thread earlier this year announcing floatplot so did you learn about it from Statalist or from some talk I gave this summer?

      Good too if you like the result. The data appear to be time series. so that suggests alternatives. Here is one experiment:

      Code:
      gen outcome = fi_/1e6
      label var outcome "whatever (millions)"
      decode jahr, gen(year)
      destring year, replace
      levelsof year
      local levels `r(levels)'
      
      // fabplot is from the Stata Journal 
      fabplot line outcome year, by(finr, col(2)) xla(`levels', labsize(small)) front(connected) frontopts(lwidth(*2)) xtitle("")
      Naturally there is room for less cryptic labels.

      Sometimes a table works as well!

      Click image for larger version

Name:	kaulisch.png
Views:	1
Size:	107.0 KB
ID:	1632692


      Comment


      • #4
        Dear Nick, yeah, I am not sure where I heard about -floatplot-. It may also be when I wanted to learn about what's new on ssc with -ssc new-.. Today I found one other thread in which -floatplot- is mentioned.
        Indeed the data is time series. Thanks for this suggestion. It is another plot I wanted to test the coming days.
        For the question I have at the data I think -floatplot- is really good because it shows how the importance of a category within an unit changes over time. Whereas -fabplot- - in my interpretation- highlights the development of each category by itself contrasted by the development of the other categories.
        Cryptic labels used to hide original data.

        Comment

        Working...
        X