Skip to content

Instantly share code, notes, and snippets.

@bbdaniels
Last active January 25, 2024 19:20
Show Gist options
  • Save bbdaniels/4df5990b87115f143f74a35d1f1516f3 to your computer and use it in GitHub Desktop.
Save bbdaniels/4df5990b87115f143f74a35d1f1516f3 to your computer and use it in GitHub Desktop.
Add percentage signs to bar graph labels
local nb=`.Graph.plotregion1.barlabels.arrnels'
qui forval i=1/`nb' {
.Graph.plotregion1.barlabels[`i'].text[1]="`.Graph.plotregion1.barlabels[`i'].text[1]'%"
}
.Graph.drawgraph
// Rounding
local nb=`.Graph.plotregion1.barlabels.arrnels'
forval i=1/`nb' {
.Graph.plotregion1.barlabels[`i'].text[1] = "`: di %2.0f `.Graph.plotregion1.barlabels[`i'].text[1]''"
.Graph.plotregion1.barlabels[`i'].text[1]="`.Graph.plotregion1.barlabels[`i'].text[1]'%"
}
.Graph.drawgraph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment