Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Regaining control over axis ranges


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Regaining control over axis ranges
Date   Tue, 25 Dec 2012 12:52:25 +0000

To omit data, use -if-. The option

xscale(range(5000 10000))

won't do that. You need something like -if inrange(price, 5000, 10000)-.

Nick

On Tue, Dec 25, 2012 at 12:39 PM, annoporci <annoporci@gmail.com> wrote:
>> You don't spell out what does not work, but -?scale()- options don't
>> omit data. That's the most common misunderstanding among those who
>> don't read the help carefully.
>>
>> Nick
>
>
> Oops, sorry about that. Here is what I want:
>
>
>>> I'm trying to shorten the y axis of a graph.
>
>
> Here is what I read in Stata Tips 23:
>
>
>>> "to get a narrower x-axis, we must specify a narrower set of axis
>>> labels...
>
>
> Let me reframe the question in terms of the Stata Tips 23 examples (based
> on the auto dataset and the x-axis):
>
> Say I want the x-axis to run from 5,000 to 10,000. Since the actual data
> extends below and above these values, I am willing to omit data from the
> graph. What can I do to achieve this goal?
>
> This won't do:
>
> twoway scatter mpg price, xscale(range(5000 10000)) xlabel(5000[1000]10000)
>
> The Stata Tip says "to get a narrower x-axis, we must specify a narrower
> set of axis labels," which at the time I took to mean that omitting data
> could be achieved that way, but now I realize that the intended meaning
> was probably "to get a narrower x-axis, but without omitting any data,
> etc."
>
> So yes, I would like to shorten the axis and omit data in the process.
>
> Thanks for your help!
>
> ---
>
> Patrick Toche.
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index