Bookmark and Share

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

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

Re: st: RE: -tabplot- and number of options limit

From   Nick Cox <>
Subject   Re: st: RE: -tabplot- and number of options limit
Date   Mon, 9 Jul 2012 16:22:45 +0100

I am surprised to hear this. But then I get puzzling results with
-xsc(noline)- outside of -tabplot-. For example

sysuse auto, clear
contract rep78
twoway bar _freq rep78, xsc(alt)
twoway bar _freq rep78, xsc(alt noline)

I see no difference here from the -noline-. I must be missing something.


On Mon, Jul 9, 2012 at 3:44 PM, Beede, David N <> wrote:
>  Thanks, Nick, that's informative, and I wonder if that is related to something else that I've noticed
>  happening.  In the -tabplot- syntax below, the -xscale(alt)- option only seems works if it appears twice
> (once in the third line and again in the eighth line).  (The only way I made it work is when I accidentally
> copied and pasted the option rather than cutting and pasting it.)  And I have noticed other times using
> -tabplot- when placement of options seems to matter (which generally I didn't think it did as long as they weren't suboptions or sub-suboptions), but unfortunately I didn't document those instances.
>    tabplot speed`z'`x' categnew if 1 <= categnew & categnew <= 20 `ifstatement' [iw=speedfreq], ///
>      percent(categnew) ///
>      showval(mlabsize(vsmall) mlabcolor(black)) yscale(reverse) xscale(alt) barall(bcolor(gs12))  ///
>      subtitle("") ///
>      ytitle("") ylabel(, labsize(vsmall)) yscale(noline)  ///
>      xtitle("") xlabel(, angle(45) labsize(vsmall)) xscale(noline)  ///
>      title("`r'", size(medsmall) span bexpand) ///
>      xscale(alt) graphregion(color(white)) plotregion(color(white)) graphregion(icolor(white)) plotregion(icolor(white)) saving(nbm_jun2011_speeds_industry_graph_`z'_`x'_`w'_1_alt4, replace)
> ___________________________________________________________________
> From   Nick Cox <>
> To
> Subject   Re: st: RE: -tabplot- and number of options limit
> Date   Sun, 8 Jul 2012 18:57:15 +0100
> What bites is not your -tabplot- syntax, or so I imagine, but what it
> implies. The way that -separate()- works is that a separate call to
> -twoway rbar- is set up for each distinct colour and each of those is
> associated with several options. Clearly I didn't try to see what the
> limit really was and my implication in the help that you can have  up
> to 20 distinct colours is unduly optimistic. My guess is that what
> fails is the final call to -twoway-: in essence -tabplot- is just a
> busy helper setting up the stage before the drama is enacted by
> -twoway-, but the -twoway- syntax implied by -tabplot- can be too much
> for -twoway- to handle.
> Nick .
> ________________________________________
> From: Beede, David N
> Sent: Sunday, July 08, 2012 11:05 AM
> To: Beede, David N;
> Subject: RE: -tabplot- and number of options limit
> Yes, Nick, that was exactly it - originally I intended to give each industry
> its own color and then abandoned that idea, but I forgot to drop the -separate()-
> option.  When I did drop -separate()-, -tabplot- worked for all 20 bars (now all with the same color).
> Thank you for your insight into the problem.
> Still - notwithstanding the silliness of separate colors for each bar - I'm curious
> about why -tabplot- ran up against the option limit, given that the "limitless option" option was
> used in the ado file for -tabplot-.
> For what it's worth, here is the exact syntax that hit the limit:
>    local i 1
>    local barcolorlist ""
>    foreach mcolor in teal blue bluishgray brown cranberry cyan dkgreen dknavy ///
>       dkorange erose emerald forest_green gold gray green khaki lavender lime ltblue ltbluishgray {
>        local barcolorpiece " bar`i'(color(`mcolor'))"
>        local barcolorlist `barcolorlist'`barcolorpiece'
>     local ++i
>    }
>     tabplot speed`z'`x' categnew if 1 <= categnew & categnew <= 20  [iw=speedfreq], ///
>         xscale(alt) percent(categnew) separate(categnew) ///
>      showval yscale(reverse) ///
>       `barcolorlist' ///
>      subtitle("") ///
>      ytitle("") ylabel(, labsize(vsmall)) yscale(noline)  ///
>      xtitle("") xlabel(, labsize(vsmall)) xscale(noline)  ///
>  graphregion(color(white)) plotregion(color(white)) graphregion(icolor(white)) plotregion(icolor(white))
> Note that 1 <= categnew & categnew <= 13 works but 1 <= categnew & categnew <= 14 (and higher) hits the option limit.
> And I forgot to mention that -tabplot- is from SSC - sorry about that.
> Thanks,
> David
> From   Nick Cox <>
> To
> Subject   Re: st: -tabplot- and number of options limit
> Date   Sun, 8 Jul 2012 02:06:56 +0100
> --------------------------------------------------------------------------------
> Thanks very much for the commendation.
> -tabplot- is from SSC. You don't cite the exact command you gave but
> at a guess what is biting you is a limit on what you can do with
> -twoway-. But my guess is that you are trying to use its -separate()-
> option to get separate colours for each of your categories. That can
> only lead to an extraordinary mess! The default with -tabplot- is that
> categories are distinguished by axis labels and 20 categories on one
> or both variables are no problem. -separate()- is intended only for
> special cases, such as highlighting a subset.
> I really need to see your exact syntax to advise well here.
> Nick
> On Sat, Jul 7, 2012 at 9:01 PM, Beede, David N <> wrote:
>> I am trying to use -tabplot- with 20 industry categories (which also happens
> to be the maximum permitted number of categories for the command according
> to the help file), but I get an error message that I have too many options (the
> default maximum number of options is 70 in Stata).  On the Stata FAQs, I see
> that one can get around the 70 option limit by using the * option in the -syntax-
> command (as in syntax[, opt1 opt2...*]), and when I took a peek at the -tabplot-
> ado file there indeed was a * at the end of syntax[].  So I am a bit puzzled why
> I get the error message.  Any thoughts?
>> And I want to convey a heartfelt thank-you to Nick Cox for -tabplot- and everything else he has generously shared with us Statans. :)
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

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