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: Fwd: graph axes crossing at the origin if plotted values are negative

From   "Nick Cox" <>
To   <>
Subject   RE: st: RE: Fwd: graph axes crossing at the origin if plotted values are negative
Date   Mon, 26 Jul 2010 18:48:04 +0100

Let's spell this out:

1. Stata is dedicated to the principle that axis ticks and labels should be kept out of the way of the data. So, axes, meaning here the orthogonal lines that carry tick and label information, are in Stata always peripheral to the data region. 

2. You can only overrule this by subversion: i.e. by instructing Stata to place text and/or short lines in the data region adjacent to particular horizontal and/or vertical lines. Otherwise put, if you want axes cutting the data region, you must construct your own. There isn't a simple switch for Stata knowingly to break #1. 

3. More positively, there is scope for subtle and even not so subtle manipulation of grid lines to emphasise any y = constant or x = constant. See for example 

SJ-9-4  gr0043  . . . . . . . . . .  Stata tip 82: Grounds for grids on graphs
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        Q4/09   SJ 9(4):648--651                                 (no commands)
        tip on when a grid within a graph is appropriate

The code for the more substantial example in that Tip is repeated here: 

sysuse citytemp
clonevar tempjanC = tempjan
replace tempjanC = (5/9) * (tempjanC - 32)
clonevar tempjulC = tempjuly
replace tempjulC = (5/9) * (tempjulC - 32)

scatter tempjulC tempjanC, ms(oh)                         ///
xli(0, lstyle(grid) lc(white) lw(*1.5))                     ///
xla(, grid glc(white)) yla(, ang(h) glc(white))             ///
plotregion(color(gs14)) xsc(lcolor(gs14)) ysc(lcolor(gs14)) ///
note({c 176}Celsius) ms(oh)

The main point is that without subversion you can emphasise lines of importance. 

4. If Susanne really wants this, then other software is surely more convenient. From occasional offerings from students, I gather that MS Excel will provide. Alternatively, whether it is really a good idea remains moot. 


Martin Weiss

Also note this thread:

Susanne Elsas

thank you for your answer,
i hoped to find a more regular way, to define the position of the axes 
(including labels and ticks).
further suggestions are very welcome,

Martin Weiss

> Try this recent thread:

Susanne Elsas

> i would like the axes of a graph to cross at (0;0), even if some of the 
> plotted values are negative.

*   For searches and help try:

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