问题
I created a colored and patterned pie chart as described in this stack exchange Question. Now I also want to specify an order of the categories to apear in the pie chart.
Usually this works with the sort.values
funtion:
SCALE: cat(aesthetic(aesthetic.color), sort.values("value", "value",...))
However this function doesn't seem to have an effect when having both color(var))
and
texture.pattern(var)
functions inside the same ELEMENT
-Statement.
回答1:
You also need to specify the category order for the texture.pattern. So add the line:
SCALE: cat(aesthetic(aesthetic.texture.pattern), sort.values("value", "value", ...))
Defining the category order for both, the color aesthetic and the texture.pattern aesthetic should result in the specific ordered pie chart.
Unfortunatly the order isn't applyied to the legend, which is quiet a bummer when trying to read the pie chart. I haven't figured out how or if this can be fixed.
来源:https://stackoverflow.com/questions/55956990/what-does-it-need-to-specify-the-category-order-in-a-colored-and-patterned-pie-c