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]

st: AW: line on top of bar graph

From   "Martin Weiss" <>
To   <>
Subject   st: AW: line on top of bar graph
Date   Thu, 18 Feb 2010 15:04:49 +0100


Here is a kludge, nothing to write home about :-( 

set obs 2
gen var=40*(_n==1)+60*(_n==2)
gen byte x=_n
twoway (bar var x, ysca(r(0)) fcolor(gold)) (function y=30, range(0 3))


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Jeph Herrin
Gesendet: Donnerstag, 18. Februar 2010 14:47
Betreff: st: line on top of bar graph

There must be a way to do this, but I can't seem to
make it happen.

I have a simple bar graph:

  set obs 1
  gen var1=40
  gen var2=60
  graph bar var1 var2, bargap(20)

and I want to add a reference line

  graph bar var1 var2 , bargap(20) yline(30)

The problem is, the added line goes *behind* the bars, and is
mostly invisible. I want -yline- to go on top of the bars, but
no combinatin of -yline- options or styles seems to make this
happen. Any ideas?


*   For searches and help try:

*   For searches and help try:

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