How to create a pie chart with color and pattern i

2019-08-17 06:22发布

I want to create a colored and additional pattern, pie chart with GGRAPH\GPL. The function of the pattern is to visualize the major category to which the respective category belongs to.

With the SPSS Chart Builder I can only create a colored or a patterned pie chart.

The relevant ELEMENT Statement looks as follows:

ELEMENT: interval.stack(position(summary.percent(COUNT))), color(myvar))

Or:

ELEMENT: interval.stack(position(summary.percent(COUNT))), texture.pattern(myvar))

1条回答
霸刀☆藐视天下
2楼-- · 2019-08-17 07:24

Taking the Syntax created for the colored pie chart you can add the texture by simply adding the texture.pattern(myVar) function into the Element statement:

  ELEMENT: interval.stack(position(summary.percent(COUNT))), color(krwirtsek_kombi), texture.pattern(krwirtsek_kombi))

You can specify the color and pattern by using a template or via the map-function inside the scale statment:

SCALE: cat(aesthetic(aesthetic.color.interior), map(("<catvalue>", color."<rgb>"),  ...)
SCALE: cat(aesthetic(aesthetic.texture.pattern), map(("<catvalue>", texture.pattern.<patternconstant>), ...)

However when combining the color() and the texture.pattern() functions in the ELEMENT Statement and the tinkering with oder GPL-funtions, the results of these other functions might get odd (see this question about category order).

查看更多
登录 后发表回答