Announcement

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

  • Nick Cox
    replied
    See https://www.economist.com/graphic-de...-to-lose-steam for a nice example of this strategy.

    Leave a comment:


  • Nick Cox
    replied
    https://www.youtube.com/watch?v=ivPk6p8O30I

    Leave a comment:


  • Jesse Wursten
    replied
    Absolutely fab-ulous

    Leave a comment:


  • Nick Cox
    replied
    Thanks to Kit Baum as ever, fabplot has been updated on SSC. The update adds several more references to the help and -- perhaps more interesting and useful -- a new select() option.

    The deal with
    fabplot -- think front and back plot -- is a mixed strategy. Several groups to compare? You could put them on top of each other (superimposed), which might well turn out to be a mess, or side by side (juxtaposed), which is likely to be clearer but makes comparison more difficult in some ways. The mixed strategy is to show each group in turn -- but with all the other groups as context.

    So, as already shown, you can do something like this:

    Code:
    webuse grunfeld, clear
    fabplot line invest year, by(company) ysc(log) yla(1 10 100 1000)
    Click image for larger version

Name:	fabplot1.png
Views:	1
Size:	89.8 KB
ID:	1570351



    and by all means zap "year", decide that you want a thicker line for each series, and so on. But what to do if only want to focus on fewer panels, say companies 1 to 4? In your case you might have 32 countries but 9 are of interest and importance, or 123 causes of death, but for the moment let's just look at the top 9.

    The restriction say

    Code:
    ... if company <= 4
    will show 4 panels, but in each case the backdrop will be the other 3. This is what the new option does:

    Code:
    fabplot line invest year, by(company) ysc(log) yla(1 10 100 1000) select(company <= 4) xla(, format(%tyYY)) xtitle("") frontopts(lw(thick))
    showing in passing that there are always small details to tweak.
    Click image for larger version

Name:	fabplot2.png
Views:	1
Size:	78.0 KB
ID:	1570352






    https://www.youtube.com/watch?v=HeERupuicHE
    Last edited by Nick Cox; 27 Aug 2020, 11:10.

    Leave a comment:


  • Nick Cox
    replied
    Then fabplot is irrelevant to you. Use xtline

    Leave a comment:


  • ali farrukh
    replied
    what if I don't want grey lines to appear in grunfield data, let suppose I want only orange line to appear,

    Leave a comment:


  • Nick Cox
    replied
    Thanks to Kit Baum, a new program fabplot is downloadable from SSC. Stata 9 is required.

    The name may seem alarming, as if groovyplot were next along, and I am all too vividly recalling 1960s slang or have been overdosing on Austin Powers movies.

    Consider the plight of the poor Stata programmer choosing the name of a new program. The name has to follow syntactic rules, it should be easy to spell and pronounce, and ideally it should match some standard name for whatever you're doing. I don't know any standard name for this procedure.

    Anyway, the idea is that fabplot can be decoded as front and back plot, or foreground and backdrop plot.

    That aside, how does fabplot differ from subsetplot?

    In essence fabplot follows the approach of #20 and #29 in rearranging data so that the graph is done using a by() option. That means less repetition of stuff along the axes.

    The following examples follow (and slightly correct) the help for fabplot.

    Code:
    set scheme s1color
    sysuse auto, clear
     fabplot scatter mpg weight, by(rep78) name(G1, replace)
     more
     fabplot scatter mpg weight, frontopts(ms(none) mla(rep78) mlabsize(*1.5) mlabpos(0) mlabcolor(blue)) by(rep78) name(G2, replace)
     more
    
     webuse grunfeld
     fabplot line invest year, by(company) xtitle("") ysc(log) yla(1 10 100 1000) name(G3, replace)
     more
     fabplot line invest year, by(company) xtitle("") ysc(log) yla(1 10 100 1000) front(connect) frontopts(mc(blue) lc(blue)) name(G4, replace)



    Click image for larger version

Name:	fabplot1.png
Views:	1
Size:	51.4 KB
ID:	1449052

    Click image for larger version

Name:	fabplot2.png
Views:	2
Size:	51.4 KB
ID:	1449054

    Click image for larger version

Name:	fabplot3.png
Views:	1
Size:	112.2 KB
ID:	1449055

    Click image for larger version

Name:	fabplot4.png
Views:	1
Size:	122.2 KB
ID:	1449056

    Attached Files

    Leave a comment:


  • Nick Cox
    replied
    As a sequel particularly to #20 this further experimentation arose out of a thread on Cross Validated: https://stats.stackexchange.com/ques...rends-properly The problem concerns death rates for 9 European countries and 11 years 1927 to 1937, hardly an enormous dataset, but challenging enough!

    Here in one are code and graph for one of the suggestions there:

    Code:
    clear
    input int year double(de fr be nl den ch aut cz pl)
    1927 10.9 16.5   13 10.2 11.6 12.4   15   16 17.3
    1928 11.2 16.4 12.8  9.6   11   12 14.5 15.1 16.4
    1929 11.4 17.9 14.4 10.7 11.2 12.5 14.6 15.5 16.7
    1930 10.4 15.6 12.8  9.1 10.8 11.6 13.5 14.2 15.6
    1931 10.4 16.2 12.7  9.6 11.4 12.1   14 14.4 15.5
    1932 10.2 15.8 12.7    9   11 12.2 13.9 14.1   15
    1933 10.8 15.8 12.7  8.8 10.6 11.4 13.2 13.7 14.2
    1934 10.6 15.1 11.7  8.4 10.4 11.3 12.7 13.2 14.4
    1935 11.4 15.7 12.3  8.7 11.1 12.1 13.7 13.5   14
    1936 11.7 15.3 12.2  8.7   11 11.4 13.2 13.3 14.2
    1937 11.5   15 12.5  8.8 10.8 11.3 13.3 13.3   14
    end
    
    rename (de-pl) (death=)
    reshape long death, i(year) j(country) string
    
    egen where = group(country), label
    gen long id = _n
    expand 9
    bysort id : gen group = _n
    label val group where
    
    separate death, by(group == where)
    
    local note "countries highlighted in turn"
    set scheme s1color
    sort group country year
    twoway  line death0 year, lc(gs12) by(group, compact note("`note'") legend(off)) ///
    subtitle(, fcolor(ltblue*0.5)) c(L) xtitle("") ///
    ytitle("death rate, yearly deaths per 1000") yla(8(2)18, ang(h)) xla(1927(5)1937, format(%tyY)) ///
    || connected death1 year, lc(blue) mc(blue) ms(oh)
    Click image for larger version

Name:	deaths3.png
Views:	1
Size:	125.4 KB
ID:	1448301

    Leave a comment:


  • Nick Cox
    replied
    William S. Cleveland's book The elements of graphing data is in my view the best single book a library could have on statistical graphics,

    Ideally you have the second edition from Hobart Press.

    I say this while continuing to admire the work of Edward Tufte, particularly the first of his self-published books.

    A graph like Schwabish's is easy to emulate.

    Code:
    sysuse lifeexp.dta, clear
    scatter lexp gnppc , mla(country)
    and yes, it's a mess. But Stata isn't telling you to use it in a presentation.

    Leave a comment:


  • Chris Vecchio
    replied
    Nick Cox Excellent and fair review. Sadly page 101 is hidden in the preview so I'll have to wait to see what the author claimed was a Stata default graph. To your point on complete sentences, I can say I've greatly benefited from this when referencing your presentations.

    I'm happy to report that our library has ordered several visualization technique books, including Better Presentations. These will add to our current collection containing a single (seemingly barely used) book, The Elements of Graphing Data.

    Leave a comment:


  • Nick Cox
    replied
    Chris Vecchio I posted a review of Schwabisch's book at https://www.amazon.com/Better-Presen.../dp/0231175213

    Stata users interested in this book should note the one comment in my review on a Stata example.

    Leave a comment:


  • Chris Vecchio
    replied
    Thanks for the additional recommendation! I somehow missed your post about Schwabish but have just purchased it and Carr/Pickle.

    Leave a comment:


  • Nick Cox
    replied
    Another one:

    Carr, D.B. and Pickle, L.W. 2010. Visualizing Data Patterns with Micromaps. Boca Raton, FL: CRC Press. p.85.

    Leave a comment:


  • Nick Cox
    replied
    See now also

    Schwabish, J. 2017. Better Presentations: A Guide for Scholars, Researchers, and Wonks. New York: Columbia University Press. p.98.

    Leave a comment:


  • Nick Cox
    replied
    Chris: Thanks for your interest and encouragement. Producing these graphs depends on being able to differentiate what is highlighted and what is not (e.g. using greyscale or very thin lines for the backdrop), and it's only fairly recently that that has become easy for most of us. Having said that, I may now stumble across an ancient example. At present the Swedish book in 1996 was almost there and Koenker in 2005 definitely was, but there must be other examples -- just far, far fewer in number than spaghetti-type graphs.

    Leave a comment:

Working...
X