How can I shade an region of a graph using the graph function?

1 Answer

Let's say I have the inequality #y>=x#. To show the boundary line, I can simply type "graph { x } " (no hashtags needed) and I'll get this:


To work with shading and multiple graphs, you need to change the format of what is graphed - essentially we add #y# terms to the graph, multiply the terms together (using brackets) and have the whole thing set to 0. And so with our example, I can write it as "graph { y-x=0 } " and get the same graph:


To shade, change the equal sign to an inequality. "graph { y-x>0 } " gives:


There are a number of existing answers that give more advanced tips on limiting graphs and shading, creating shaded shapes, and more. Here are a few: