Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Why is the legend in xtline limited to 2 to 15?


From   William Buchanan <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Why is the legend in xtline limited to 2 to 15?
Date   Wed, 12 Mar 2014 07:00:07 -0500

Agreed.  That has been the question that I've received the most from folks working in different school districts around the State (even though the graphs were extremely explicit about the school of interest).  

If you could share any of the code that you (Austin, not Nick [although Nick does some pretty awesome work with data visualization too]) used to create the graph/JavaScript.

Thanks again,
Billy

Sent from my iPhone

> On Mar 12, 2014, at 6:29, Nick Cox <[email protected]> wrote:
> 
> Excellent! I imagine many people would want to hear much more.
> Nick
> [email protected]
> 
> 
>> On 12 March 2014 11:20, Austin Nichols <[email protected]> wrote:
>> re: " interactive graphic in which
>> names pop up on demand and the curious reader can interrogate at will.
>> I leave this on one side because you can't do in Stata."
>> 
>> It's relatively easy to write out some JavaScript from Stata to go
>> with a series of graphs, e.g. the graphics in
>> http://blog.metrotrends.org/2014/03/good-dcs-schools/
>> are straight out of Stata, which also writes the content of the drop-down menu.
>> 
>> 
>> 
>>> On Wed, Mar 12, 2014 at 7:05 AM, Nick Cox <[email protected]> wrote:
>>> Peeling off the last question: Don't use a legend for one item. Seeing
>>> that reminds me of a certain spreadsheet application, which if I
>>> remember correctly uses by default the legend "Series 1" for one
>>> variable; it doesn't even say "G", or whatever, which in its own terms
>>> would mean something. Use a title or (usually better) a subtitle for
>>> that information; you can just add it yourself.
>>> 
>>> On the main question:
>>> 
>>> I am guessing here, but have a look at -help pstyle- for a clue. By
>>> default there are 15 different plotstyles, so I imagine that if you
>>> don't spell out 17 or 20 different ways of showing 17 or 20 different
>>> countries, -twoway- is just going to cycle around the same
>>> possibililities from 16 onwards.  I don't think I've ever tried it.
>>> 
>>> I am impressed at your optimism that this could work well at all. With
>>> 17 or 20 countries,
>>> 
>>> a. Clearly the country names mean something and you would prefer
>>> seeing them, but a legend with that many entries will take up a large
>>> fraction of your real estate.
>>> 
>>> b. The plot itself is all too likely to look like a tangled mess.
>>> 
>>> This is a standard problem, and a difficult one, and all solutions are
>>> wrong from some point of view, but let's try some positives:
>>> 
>>> 0. There's a serious argument, which is hardly novel, that the only
>>> way to do this properly is through an interactive graphic in which
>>> names pop up on demand and the curious reader can interrogate at will.
>>> I leave this on one side because you can't do in Stata. Whether it
>>> would be the answer for Nirina I can't tell.
>>> 
>>> 1. Separating the series, one to a panel, might be tolerable. Names
>>> would be shown better, but clearly you lose out on how easily you can
>>> compare the series. Naturally that's the default for -xtline-. (I
>>> guess that Nirina is using the -overlay- option.)
>>> 
>>> 2. There is a compromise in which every panel contains all the series,
>>> best shown as a backdrop, but each panel highlights just one series.
>>> The main idea occurs in many places, but two that spring to mind are
>>> http://www.stata-journal.com/sjpdf.html?articlenum=gr0046 and
>>> http://www.stata-journal.com/sjpdf.html?articlenum=gr0040 The links
>>> lead to .pdf accessible to all.
>>> 
>>> 3. Do you need all the countries to be identifiable? Sometimes what
>>> works reasonably is to show all and just to identify only a few
>>> countries of greatest interest. We don't know what the research is
>>> here, but it is rare in my experience that every country really needs
>>> individual identification and comment.
>>> 
>>> Nick
>>> [email protected]
>>> 
>>> 
>>>> On 12 March 2014 08:56, Nirina F <[email protected]> wrote:
>>>> 
>>>> I have panel data and I am graphing a simple line graph through
>>>> years for 17 and then 20 countries with xtline. It looks like the
>>>> legend is only limited to 15 countries so then it reports to me two
>>>> countries under the same legend such as this ---------USA/Luxembourg
>>>> and ______China/Uruguay when I graph 17 countries and then five
>>>> countries under the same legend for 20 countries. do you know how to
>>>> expand it so it is not confusing like this?
>>>> 
>>>> Also, when I am just graphing one country
>>>> xtline yvar if Country=="USA", overlay then I do not get the legend
>>>> that that single line is for USA and I do not see any option to add
>>>> legend.
>>> *
>>> *   For searches and help try:
>>> *   http://www.stata.com/help.cgi?search
>>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>>> *   http://www.ats.ucla.edu/stat/stata/
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> *   http://www.ats.ucla.edu/stat/stata/
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index