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, is already up and running.

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

st: Twoway graph with different scaled y axes

From   Maria Ana Vitorino <>
Subject   st: Twoway graph with different scaled y axes
Date   Tue, 19 Mar 2013 16:24:09 -0500

Dear Statalist members,

I'm trying to do 2 graphs on the same figure but am having trouble with twoway.

Here is a sample of my data:

agegroup	gender   cases   rateper1000
15-20	F	      10000     5.3
20-25       F	      15000     8.3
25-30       F	      12000     6.5
15-20	M	      18000     9.3
20-25       M	      12000     5.3
25-30       M	        8000     2.5

I would like to have both figures in the same plot:

1) graph bar cases,  over(gender, label(labsize(small))) asyvars over(agegroup, label(labsize(vsmall))) ytitle("Number of Cases") b1title("Age")


2) a graph that has the variable rateper1000 on another axis and that shows (with dots) the rate per agegroup and age and connects those dots.

The figure at
depicts well what I am trying to achieve.

Any suggestions are welcome!



*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index