Closed kbjarkefur closed 9 months ago
The error reproduces as submitted by user.
The fix was quite straightforward and is implemented in f4ac0a1e27ed6b5aba02904f0273e93974b8b9ec.
OP followed up and suggested that baroptions()
should be possible to set colors for individual bars. This is not possible using baroptions()
as the bar options specified in that option is added to all bars.
Instead, in 0bfb72cb9ba7b7f0acc05a4383bd6d6ea6211440 a new option barcolors()
was added. This option allows the user to manually specify colors, as in barcolors(`" red gs14 "215 25 28" gold cranberry "')
. Any color listed in
https://www.stata.com/manuals13/g-4colorstyle.pdf may be used.
Test this option like this:
sysuse auto, clear
replace foreign = floor(runiform()*5)
gen f1 = (foreign == 1)
gen f2 = (foreign == 2)
gen f3 = (foreign == 3)
gen f4 = (foreign == 4)
gen ctrl = (foreign == 5)
reg price f1 f2 f3 f4 weight
iegraph f1 f2 f3 f4 , legend(pos(6) rows(1)) barcolors(`" red gs14 "215 25 28" gold cranberry "') barlabel barlabelformat( %9.2f) mlabcolor(blue)
If barcolors()
is used together with baroptions(color(green))
then the later takes precedence, as baroption()
has the highest precedence to allow the user to overwrite any options used.
Issue submitted by email from @oscarmdiazb :