# How to set the color of a graph/point using CL

I have the function f(x) defined in a calculator screen.

I would like to have the graph of it in a particular color using the rgb function.

How can I do this?

If you’re using rawExpression you can use rawExpressionColor but if not I always just get lazy and make a line y=f(x) in the calculator and set the color in the graph

Making a line y=f(x) in the graph and setting the color there isn’t a lazy workaround - it’s the recommended way to format, since it gives you easy access to all of the things you can do with the function (dashed lines, colors, inequalities, etc.), instead of needing to learn a new mechanism.

If you need to specify a specific custom color, then we don’t have a well-supported way to do that right now. rawExpression and rawExpressionColor are deprecated and shouldn’t be used for new things.

1 Like

I’m not against the normal way of setting the color, but in this particular case I wanted two graphs to be light gray, for students to sketch the product of functions on the same axes and have the original graphs not be too distracting.

Sounds like I might need to wait for a supported way and in the mean time hack something together with rawExpressions.

2 Likes

I also have a need to set the color in code.

I’m wondering of there is an update to this. I too would like more control over the color/transparency of graphs and points. I know I have seen an example with rawExpression, but I can’t find it now :{

So, could you instead of doing ‘y=f(x)’ in the graph, do ‘g(x)=f(x)’? That way you can control the color of g(x) in the CL?

Hello there,

I don’t have a y =f(x). When students type in the equation of the circle and the circle shows on the graph, I would like the students circle to be a different color than the given circle so they are well aware that their equation of the circle is correct. I am thinking that I should give the students a thumbs up when they did write the equation correctly.

The first line in your graph is what graphs the circle. I wish there were an easier way to set the color, so you have to do a workaround. Try removing the 0=f(x,y) in line 1 and graph a function that is defined. From there, you should be able to change the color and other characteristics - maybe make it a dashed line so the students can see the overlay easier. Then delete that function that you just created (backspace to delete, don’t click on the X) and replace it with the original 0=f(x,y).

You can also keep the 0=f(x,y), but define f(x,y). Then, set the color and features for 0=f(x,y), and either delete f(x,y) or leave it since it gets overwritten anyway.

@cwinske, you can’t actually set colors for multi-variable functions because it moves into 3-dimensional coordinates and won’t graph.

Hey,

Okay, so how do I define f(x,y)? How do I set the color and features for 0=f(x,y)? I am a person who searches for what I need and copy and paste the CL and change the questions and answers and such. I am a copy and paste CL kind of person. haha.

I just looked at the activity again and it looks like you have a function written now? To change the color, you can either click the gear icon right above the expression list or do a long press on the red dot next to 0=f(x,y). From there, you can choose a different color.

1 Like

Looks like f(x,y) is already defined in the CL using parseEquation( ).differenceFunction( ). See @cwinske’s post above for changing colors and features.

woohoo! That was what I needed! I was thinking, wait I need to define another function? I already had one lol. Sorry for the confusion. Thank you again.

Pamela Knapp

When I last checked, all you needed to do was change the color –⁠ everything else was working. You can do that using the steps I described above.