You are not logged in. You can browse but not post. Login or Register by clicking 'Login or Register' at the top-right of this page. For more information on Statalist, see the FAQ.
Is it possible to have a "combined pie graph" with a unique legend?
I used "graph combine" command to combine 4 pie graphs and I would like to have one legend for this combined figure instead having a legend for each figure.
If a common legend makes sense, you should be able to recast this as a problem soluble with a by() option.
https://journals.sagepub.com/doi/pdf...36867X20976341 explains the strategy. You might need to reshape the data or create extra variables. I can't see in #1 any information that would allow precise suggestions of code.
Not only can -grc1leg2- allow you to have a single legend for two pie charts, as Compaore Georges requests, but it can also created an Excel-style "bar of pie" chart with a common legend. See Example 3.10c in the -grc1leg2- help file, which produces this graph:
By the way, as I hope my help file for -grc1leg2- makes clear, I agree completely with Nick Cox's point that Stata's graph ..., by() capability will often be the cleanest approach to constructing a multi-panel graph with a single legend. From inside Stata type help grc1leg2##remarks, where I suggest that using grc1leg2 is the third choice for constructing a multi-panel graph with a single legend. The first choice, I believe, should be to follow Nick Cox's advise in his Stata Tip #139, to which he links in the previous post on this thread. See Examples 1.1, 1.2 and 1.3 in help grc1leg2##ex_gr_by and also the diverse intriguing examples in Nick's Tip #139 and in his frequent contributions on the graph ..., by() option here on Statalist.
The second choice is to carefully construct the component graphs without legends, except for one of them with a legend which works for all the panels. Then use Stata's gr combine. See Examples 2.1, 2.2 and 2.3 in help grc1leg2##ex_grcomb.
If neither of these approaches works for your visualization problem, I agree with Nick that you should consider whether the panels you are proposing to combine would be more easily understood as entirely separate graphs.
grc1leg2 is intended for use in two situations. First, in the course of research, one may be producing multiple individual graphs and not want to spend the time figuring out how to use graph ..., by() to combine them in an early draft of the report. In this case, using either gr combine or grc1leg2 may be an expedient first step towards deciding how to communicate the essential points within the space constraint. For example, a researcher recently told me that he had used grc1leg2 in early drafts of a paper shared among co-authors, only to re-assemble the component images in a LaTex version for journal submission.
Second, and I believe most important, grc1leg2 is relevant in the situations where a compelling visualization is best served by a multi-panel graph with a legend that cannot as easily be produced using either gr ..., by() or gr combine. Perhaps the "bar of pie" chart in my Example 3.10c is such a use case.
Yet more, for showing proportions in a 4 x k display, use one multiple bar chart or dot chart and you don’t need even one legend. People could show you that given a data example.
Comment