MaplePortal/SettingCurveColors - Help

Setting Curve Colors

 Introduction Learn how to control the color of curves in 2-D plots. By default, Maple selects the color of each new curve for you, but you have the ability to change the color, determine the color choice in advance, or even modify the default color sequence.  This document will also explain how to access the wide variety of colors choices.

Changing Colors Interactively—Existing Plots

If the plot is already in your document, use the Context Panel to change its appearance. To change the color of a curve on a 2-D plot, first click on the curve you wish to change. The curve will be highlighted. See Figure 1. When the curve is highlighted, from the Context Panel, select Color, and then choose the color from the list.

 Figure 1 - Changing the color of the selected curve

Tip:  It is essential that the curve is selected. If your change appears to have no visible effect, it is most likely because the curve was not selected first. Select the curve (it will be highlighted, as shown above), and try again.



If you already know which colors you wish to use, you can set the colors in advance, before the plot is created. Doing so results in a plot that will always use the colors you asked for, even if the document is re-executed.

Using the Plot Builder

The plot builder can be used to set various properties of the plot before its creation. Exter an expression. From the Context Panel, select Plot Builder.  Select 2-D plot.  Then click Color Options. From there, you can select a color palette, color, background color, axes color and more.  The available options vary depending on the plot type you have chosen. See Figure 2.



 Figure 2: Setting colors with the Plot Builder Options dialog

Choose a color from the drop-down list or select a color palette first. To see the colors in each palette, from the ColorTools overview page, view the hyperlinks under List of Color Collections.  In Figure 2, the Bright color palette was selected.  Both the curve color and the background color were then selected from this palette.

$\mathrm{ColorTools}:-\mathrm{DisplayPalette}\left("Bright",\mathrm{noextend}\right);$

 1. Blue 2. Red 3. Green 4. Purple 5. Cyan 6. Orange 7. DarkBlue 8. BluishGreen 9. ReddishPurple 10. DarkRed 11. DarkGreenishBlue 12. GreenishYellow 13. DarkBlueGreen 14. DarkGreenishYellow 15. PurpleRed 16. VividGreen

Figure 3: The Bright color palette

Tip: Since the Plot Builder lets you select different color options in the Plot Builder window and view the updated plot, it's easy to modify the plot until you like the result. If you might want to reuse your plot or create variations of it, you can choose to view the command used to create the plot (in the Plot Builder window, select show command).

Using the plot command

You can pass in a list of colors to the plot command. For a single curve,

If you have more then one curve, put the curves in a list, and the colors in a corresponding list:

The color=colorname option can be used with most plotting commands, in addition to the plot command itself.

Note: The color names are given as strings in double quotes ("Blue").  This is the new form for color names. In earlier releases, a more limited number of colors were available and were given as symbols, often were enclosed in quotes ('blue') to avoid evaluation. For backwards compatibility, this form will still work with the old color names, but new color names must be strings.

For the complete list of valid color names, including the mapping from the old names to the new names, see plot/colornames.

Tip: Maple also accepts the keyword "colour" as a valid alternative spelling.

Changing the Default Colors

Maple follows a standard list of colors, choosing the next color in the list for the next curve on that set of axes. The default color choices can be seen by calling the plots[setcolors] command with no arguments.

$\mathrm{plots}\left[\mathrm{setcolors}\right]\left(\right)$

 $\left[{"#78000E"}{,}{"#000E78"}{,}{"#4A7800"}{,}{"#3E578A"}{,}{"#780072"}{,}{"#00786A"}{,}{"#604191"}{,}{"#004A78"}{,}{"#784C00"}{,}{"#91414A"}{,}{"#3E738A"}{,}{"#78003B"}{,}{"#00783F"}{,}{"#914186"}{,}{"#510078"}{,}{"#777800"}\right]$ (4.1)

To change the default list, provide a new list of colors. The current color list is returned.

 $\left[{"#78000E"}{,}{"#000E78"}{,}{"#4A7800"}{,}{"#3E578A"}{,}{"#780072"}{,}{"#00786A"}{,}{"#604191"}{,}{"#004A78"}{,}{"#784C00"}{,}{"#91414A"}{,}{"#3E738A"}{,}{"#78003B"}{,}{"#00783F"}{,}{"#914186"}{,}{"#510078"}{,}{"#777800"}\right]$ (4.2)

Now plots will use the new color list.

Note: If you have more curves then colors in your list, those colors will be used again. Maple cycles through the list as often as required.

To reset the color list to the default colors, use:

$\mathrm{plots}\left[\mathrm{setcolors}\right]\left(\mathrm{default}\right)$

 $\left[{"BlueViolet"}{,}{"Coral"}\right]$ (4.3)

You can specify a list of color names or a palette.  See plots[setcolors] for more information.

 See Also