Question

There is this example in my workbook that gives me a list of information and asks to draw a pie chart representing this information. The ONLY module that you can import is turtle. I can draw the pie chart like in figure 1 but I do not know how to separate one segment from all the rest like in figure 2.

Figure 1: http://msenux.redwoods.edu/math/python/graphics/pie2.png

Figure 2: http://www.aecbytes.com/illustrations/viewpoint/2013/issue_67-images/fig11.png (I realise that figure 2 was created in word)

All I need to know is how to separate just one of the segments with it still being in-line with the whole circle.

Any help would be great

Était-ce utile?

La solution

Depends on your design. If the center of the diagram is at the origin, you can add an offset to the coordinates of the section before it's drawn. If, for example, the segment were one quarter of the piechart from 0 to 90 degrees on the unit circle, you could offset the segment along the vector that bisects the section (1,1).

But, if you want some decent feedback, post minimal working code so we can go over it.

Also, if the image you linked is yours, you are waaayyy beyond color-blind.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top