help polarbar/circlebarpolarbar/circlebar v1.5 (GitHub)

circlebar

: A Stata package for polar bar graphs.

Please note that this command is also mirrored as polarbar to align it with other polar packages.

Syntax

circlebar var [if] [in], by(var1) [ stack(var2) ]
[ radmin(num) radmax(num) circles(num) gap(num) alpha(num) palette(str) nolabels rotatelabel showvalues
nocircles circtop range(num) nocirclabels circlabformat(str) circlabsize(str) circlabcolor(str)
labcolor(str) rotate(num) lcolor(str) lwidth(str) circcolor(str) circwidth(str)
labgap(num) labsize(str) cfill(str) clcolor(str) clwidth(str) points(num)
nolegend legsize(str) legposition(str) rows(num) half sort *
]

circlebar var, by(var1) stack(var2) The minimum syntax requires defining a numerical var variable. The placement around the circle is determined by the by(var1) variable.
The pie slices can be stacked by the stack(var2) variable. If there is more data than is required, then the program will collapse the data using the mean value of the var by var1() and var2().
If you want other ways of summarizing the variables, then it is highly recommended to prepare the data beforehand.

range(num) The height of the circles can be controled by defining an upper bound using range(). This ensures that data can be made comparable across graphs.
Note that if the range() value is lower than the maximum height value in the data, the program will throw an error.

radmin(num) radmax(num) The circles are scaled between a minimum and a maximum radius defined by radmin() and radmax() respectively.
radmin() can be set to 0 to start from the origin. This combined with the stack() option will produce Florence Nightingale's Coxcomb or roseplots.
Default values are radmin(4) and radmax(10).

half The the polar bar graph in a semi circle. This option is still beta and might contain bugs.

sort Numerical sort the polar graphs. This option is still beta and might contain bugs.

circles(num) The number of rings to plot between the minimum and maximum circles. Default value is 5 for five circles.

rotate(num) Rotate the whole graph by num degrees. For example, ro(30) is a 30 degree clockwise rotation. Default is ro(0).

gap(num) A gap in degrees between the pie slices. For example, gap(2) will space the slices by 2 degrees. Default is gap(0).

alpha(num) The transparency control of the arc area fills. The value ranges from 0-100, where 0 is no fill and 100 is fully filled.
Default value is alpha(100). Use this carefully with the stack() option as it might cause weird color blendings.

palette(str) Color name is any named scheme defined in the colorpalette package. Default is tableau.

circtop Draw reference circles on top.

nocircles Hide the reference circles.

nolabels Hide the slice labels.

rotatelabels Rotate the slice labels to orient themselves with the angle of the slices.

labgap(num) Gap of the slice labels. Default value is labg(5) for 5% of the radius of the largest slice.

labsize(str) Size of the slice labels. Default value is labs(1.6).

labcolor(str) Color of the slice labels. Default value is labc(black).

nocirclabels Hide the labels of the reference circles.

circlabformat Format the labels of the reference circles. Default is circlabf(%5.0f).

circlabsize Size of the labels of the reference circles. Default is circlabs(1.8).

circlabcolor Color of the labels of the reference circles. Default is circlabc(gs8).

lcolor(str) Color of the slice outlines. Default value is lc(white).

lwidth(str) Line width of slice outlines. Default value is lw(0.1).

circcolor(str) Color of the circles. Default value is circc(gs10).

circlwidth(str) Line width of the circles. Default value is circlw(0.1).

cfill(str) The fill color of the center circle. Default value is cfill(white).
This option is especially useful if a non-white background is used.

clcolor(str) Line color of the center circle line. Default is clc(white).

clwidth(str) Line with of the center circle line. Default is clw(0.2).

points(num) Advanced option for setting the number of points to generate the circles. Default is points(500) which works fine.

nolegend Turn off the legend.

rows(num) Number of legend rows. Default is rows(3).

legsize(str) Size of legend entries. Default is legs(2.2).

legposition(str) Position of legend. Default is legpos(6) for 6 o' clock.

* All other standard twoway options unless overwritten by the program.

Dependencies

The palette package (Jann 2018, 2022) is required:

ssc install palettes, replace
ssc install colrspace, replace

Even if you have these installed, it is highly recommended to update the dependencies:
ado update, update

Examples

See GitHub.

Package details

Version : polarbar circlebar v1.5
This release : 28 Apr 2024
First release: 18 Nov 2022
Repository : GitHub
Keywords : Stata, polar bar graphs
License : MIT

Author : Asjad Naqvi
E-mail : asjadnaqvi@gmail.com
Twitter : @AsjadNaqvi

Feedback

Please submit bugs, errors, feature requests on GitHub by opening a new issue.

References

Jann, B. (2018). Color palettes for Stata graphics. The Stata Journal 18(4): 765-785.

Jann, B. (2022). Color palettes for Stata graphics: an update. University of Bern Social Sciences Working Papers No. 43.

Other visualization packages

arcplot, alluvial, bimap, bumparea, bumpline, circlebar, circlepack, clipgeo, delaunay, joyplot,
marimekko, polarspike, sankey, schemepack, spider, streamplot, sunburst, treecluster, treemap, waffle