Color sections of a circular shape

Eve-Marie Grenier shared this question 5 days ago
Needs Answer

d6548ed565415aa002f0b3c3eb6b3418b106f87f85cc6d946205775136c55c59I need help with coloring sections of this circular shape, thanks!

Comments (3)


Colouring areas in the 2D-view can be done by describing them with inequalities. Here's an example to get such a circular checker pattern that even allows an arbitrary set of radii.

radii = {0, 1, 2.2, 3.3, 4, 5}
pattern = Join(Sequence(Sequence({x² + y² ≥ (radii(j))² ∧ x² + y² ≤ (radii(j + 1))² ∧ Simplify((-1)^(k + j + 1) x y) ≤ 0 ∧ Simplify((-1)^k x² ≥ (-1)^k y²)}, k, 0, 1), j, 1, Length(radii) - 1))
You might want to go to the properties of "pattern" and set the Line Thickness to 0, because Geogebra also draws the boundary lines for each inequality, and because each inequality is used in multiple areas, those lines are then drawn multiple times and appear very thick.

As for what those commands do:

  • The first command just defines the list of the radii to be used. Should be in ascending order. Also should start with 0 unless you want an empty inner circle.

  • The second command constructs a list containing all the shaded areas (each one as a list of inequalities) that make up the pattern. The "Simplify" commands in there are not strictly necessary, they just make the inequalities a tiny bit simpler and better to read in the output. The "Join" command in there is also just to have a simple list of patterns instead of a list of lists, but doesn't really affect what is drawn in the geometry view.

For a regular sequence of radii you can of course omit defining the radii list and just put the correct expressions in the pattern sequence.

It's also possible to use an arbitrary number of arbitry angles for the pattern, but it's a bit more annoying to do that. I kinda assume you only wanted the regular pattern with 45° angles anyway.

Edit: Removed some unnecessary part of the command (remnant from an arbitrary angle approach).


Nice! What's Simplify() for? It seems OK without it


As said in my post, the "Simplify" aren't really necessary, but they make the output in the Algebra window nicer. Without them it looks - at least for me in Geogebra 5 - like this


I considered all those non-simplified powers of -1 ugly enough to warrant putting some "Simplify" in.

© 2021 International GeoGebra Institute