Tuesday, October 1, 2013

HP Prime Tip: Changing the Color of a Function

In the graphing apps of the HP Prime, like the Function, Advanced Graphing, Parametric, and Polar apps, expressions can be graphed in various colors.

There are two ways to change the colors of a graph. First, the easy, but limited way.

For this example, I am going to use the Function App with F1(X) = 2 * e^(SIN(X)). Assume the View is set to Autoscale.


1. Press the Symb key. To the left of the expression box is the color box. Move left until the color box is highlighted. You will know that the color box is highlighted when the screen says "Choose graph color".

2. Hit the Choose soft key. An array of nine colors will appear. Choose the desired color and press Enter. For this example I will select red.

Here is F1 graphed in red:

However, what if you want to:
1. Graph the function in a color other than the nine presented in the Symbolic page? (This includes black)
2. Be able to change the color of the function in a program?

We can do that too, with the following:

F1(COLOR):=#RRGGBBh where RRGGBBH is a hexadecimal code, or
F1(COLOR):=RGB(red, green, blue)

You can type the command in either Home mode set to Textbook or Algebraic Entry or Program Editor mode.



Caution: Doing this in CAS mode will result in the color code stored in the function - not desirable.



If you are in Home Mode, RPN Entry, either:

1. Enter the hexadecimal code
2. Press Enter
3. Type 'F#(COLOR)' in single quotes. Press Enter. (use the appropriate name and type).
4. Press Shift+EEX (STO>).

or

1. Enter the red intensity, press Enter
2. Enter the green intensity, press Enter
3. Enter the blue intensity, press Enter
4. Execute RGB(3). In RPN mode, the 3 tells the Prime to take the last three stacks as the arguments of RGB.
5. Type 'F#(COLOR)' in single quotes. Press Enter. (use the appropriate name and type)
6. Press Shift+EEX (STO>).




The maximum values for each of the colors is 255, or FF in base 16. This is similar to the range of colors you can choose from on a typical personal computer program. 0 is the least intense, 255 is the most intense.

For a list of colors and their color codes, one of the web pages you can visit is http://www.rapidtables.com/web/color/Web_Color.htm. Scroll down to see a table that has both hexadecimal and RGB codes.

Let's demonstrate with F1(X) = 2 * e^(SIN(X)).

First graph F1 in black. The RGB code for black is RGB(0,0,0) or #00000h. I have the calculator set to Home Mode, Textbook Entry.

Now plotting F1 in Dodger Blue, RGB(30,144,255) or #1E90FFh in Home Mode, RPN entry:

That is how to plot in color. Until next time,

Eddie


This blog is property of Edward Shore. 2013

Spotlight: Akron Brass FireCalc Pocket Computer

Spotlight: Akron Brass FireCalc Pocket Computer Welcome to a special Monday Edition of Eddie’s Math and Calculator blog. Thi...