-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sunburst donut plot/chart #12
Comments
Dear Eric, Thanks for the detailed comments! I have pushed v1.8 which now depends on graphfunctions package (install the latest one directly from GitHub for now) for label wrapping and generating the center circle fill. This considerably improves the fill options since we no longer rely on Stata functions to generate 2x half circles which create their own wierd artifacts with semi-visible lines. Option On wrapping at a certain character: it is on my to do list. |
Also note that |
Dear Asjad, |
Dear Asjad,

You provided code as an example how to create a donut plot/chart using
sunburst
I have tried some options to adjust the plot using this code:
sunburst pop, by(region) full format(%15.0fc) labsize(3) wrap(7) plotreg(fc(gs12)) cfill(gs12) lc(gs12) lw(0 0)
which results in:
There are no errors as such, but I do observe some points for improvement while creating a donut:
Although I have set the color of the plot region, using the
cfill
andlc
option togs12
, the cfill circle in the center (that is on top of 'pie slices' below it) does seems to keep its line set to white. Either separate options could be useful, likecfill(lc(gs12) fc(gs12))
or the option to set the line width to 0, likecfill(lw(0))
. I prefer full control with all these options (whenever a line or an area is drawn).It is very nice to have the option to wrap long strings of segment labels, like using

wrap(7)
. But this option is rather limited when we can only 'hard code' it as the set number of characters, like 7 in the above example. A huge improvement would be the ability to wrap a string before or after a set character. E.g. for this case that would bewrap(b("("))
, i.e. wrapb
before the character open bracket "(". Which would put the data and their opening and closing brackets below the regions' text. Even smarter would then be to also drop the space character before the open bracket while centering the label in the donut segment.This would look like:
Likewise we could have the option
wrap(a("."))
, i.e. wrapa
after the character dot "." that is first encountered in the string of characters (no example of that here now).More important would be an option to be able to rotate the start position of the donut sections that (I assume) follow also here the standard Stata procedure by starting from 0 degrees at the 3o' clock position (angles are counter-clockwise). I try to replicate the example published by Andrew Musau as a Stata Tip in The Stata Journal:



What really is the issue here is that Stata draws the segments clockwise starting from the 12o' clock position, whereas
sunburst
appears to start from the 5o' clock position, like:To get
sunburst
to replicate the same position of the regions we would need to rotate (counter-clockwise) about 201° which would look like:I am not certain what would be more flexible, an option to control the rotation of the sunburst by any number of degrees [0,359] or something that rotates the start position of the first donut segment from the 5o' clock position to any other 'time' on the clock [1,12]. Probably both have their use. Or maybe I have it all wrong and something else requires a change in the
sunburst
code to have it draw categorical donuts clockwise from the 12o' clock position.Best,
Eric
The text was updated successfully, but these errors were encountered: