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

# Re: st: level and distribution plot side by side

 From annoporci To statalist@hsphsun2.harvard.edu Subject Re: st: level and distribution plot side by side Date Sun, 06 Jan 2013 14:15:12 +0800

```I did some more work on "nice numbers" on logarithmic scales about a
year ago, but I need to go back and finish it.
```
```
Great! Is there a simple way to have the powers of 10 printed as
superscripts rather than as a caret(^)?

Thanks for the other references, Nick.

```
```He comments that Statalist "is so busy that it is close to worthless if
you are not looking for something specific".
```
```
I find myself drawn to the Statalist archives all the time. The only thing
is that you often need to read several exchanges in the thread and it is
```
often cluttered by several layers of replies within the message (like below); otherwise
```I think Statalist is a really great source of info, both specific and
general.

```
```I did some more work on "nice numbers" on logarithmic scales about a
year ago, but I need to go back and finish it.

A more systematic approach to a related (but not identical) problem is
discussed in

```
SJ-8-1 gr0032 . . . . . . . Stata tip 59: Plotting on any transformed scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox Q1/08 SJ 8(1):142--145 (no commands)
```        tip on how to graph data on a transformed scale

http://www.stata-journal.com/sjpdf.html?articlenum=gr0032

and implemented in -mylabels- from SSC.

```
For your time scales, consider different formats for the time variable and also
```
```
SJ-7-4 gr0030 . Stata tip 55: Better axis labeling for time points/intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox Q4/07 SJ 7(4):590--592 (no commands)
```        tip on labeling graphs for time points and time intervals

http://www.stata-journal.com/sjpdf.html?articlenum=gr0030

Nick

P.S. I didn't know (or had forgotten) about Rense Corten's blog. He
comments that Statalist "is so busy that it is close to worthless if
you are not looking for something specific".

On Sat, Jan 5, 2013 at 6:46 PM, annoporci <annoporci@gmail.com> wrote:

```
2) I discovered a very useful piece of code to have the labels of a log plot
```display powers of 10.

It is on Rense Corten's blog (comments off):
http://www.rensecorten.dds.nl/index.php/2011/03/labeling-logarithmic-axes-in-stata-graphs/

It's similar to something you wrote on Statalist back in 2003:
http://www.stata.com/statalist/archive/2003-11/msg00770.html

I adapted it to make it a little more systematic, e.g. writing:

forval x = `expmin'(`expstp')`expmax'{

forval x = 2(1)5{

and I have set up some calculations beforehand decide what the values of
expmin, expstp, expmax should be, based on the data being graphed.

```
The whole thing could be wrapped into a program (by someone more able than
```me).

```
I hesitate to post my version of the code since the original was not written
```by me.

There isn't an awful lot I can give back to Statalist now, but hopefully
some day...

Thanks Nick.

--
Patrick Toche.

Here is an example.

sysuse sp500, clear

histogram close, horizontal xsc(reverse) normal freq ysc(off)
fxsize(20) name(g1, replace) width(10)

line close date, ysc(alt) yla(, ang(h)) name(g2, replace) xla(,
format(%tddd_Mon)) xtitle("2001")

graph combine g1 g2, ycommon imargin(small)

However, this example does not imply that I just wrote down these
commands. No; this is the cleaned-up version after making numerous
small changes. Open a do-file editor with a script once you have
commands that work, expect to have to make many tweaks. -name(,
replace)- is a crucial detail.

Nick

On Sat, Jan 5, 2013 at 10:37 AM, Nick Cox <njcoxstata@gmail.com> wrote:
```
```
See -help graph combine- and then the manual entry. In Stata terms,
you combine using graphs from -twoway histogram- and -twoway line-.
Nick
Patrick Toche <annoporci@gmail.com> wrote:

```
I saw this very nice graph: the main graph area has a twoway line of some very spiky data, in a standard horizontal orientation; immediately next
```to
it, on the left-hand side, is a frequency plot displayed sideways.
Does anyone have sample code for this sort of display?
many thanks.
A picture speaks a thousand words:
http://www5.picturepush.com/photo/a/11879063/640/11879063.jpg
```
```*
*   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/
```
```

--
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/
```