MATHEMATICA HOW TO

How to | Change the Type and Color of Points in a 2D Scatter Plot

While the default settings for plots created in Mathematica are sufficient in most cases, nearly every aspect of plots is customizable. In addition to letting you change the size of points in a 2D plot, Mathematica also lets you change the color and type of marker for points.

Mathematica lets you change the type of marker that is used as a point in a plot by using the PlotMarkers option.

First, define some data to plot:

 Out[6]=

Use ListPlot and PlotMarkers to plot the data with an asterisk for data points:

 Out[33]=

Mathematica contains many special characters and symbols that can also be used as points in a plot. You can access these from the Special Characters palette (located in the Palettes menu), or by using the keyboard alias for the character you want to use. To view the keyboard alias for a character, mouse over it in the palette.

You can also create your own plot markers from scratch:

 Out[30]=

Use the graphic you just created as a plot marker with a size of :

 Out[31]=

To change the color of points in a plot, use the PlotStyle option. Here, the color Red is specified:

 Out[35]=

Any of the colors supported by Mathematica can be used to color points in a plot.

In this example, RGBColor is used with Manipulate to allow dynamic setting of the color. Move the sliders to set different values for , , and :

 Out[7]= Play Animation ▪

First, define some datasets that you will plot:

Plot the data using ListPlot:

 Out[11]=

Use PlotMarkers to specify the point type and size for each dataset. The position of the point type and size specification in the list to the right of PlotMarkers corresponds to the dataset of the same position in the list that is the first argument to ListPlot.

In the plot here, specifies the point type and size for the dataset , and so on. The markers come from the Special Characters palette:

 Out[12]=

Change the colors from the default scheme by using PlotStyle with similar syntax:

 Out[13]=

Mathematica also lets you change the color of points in 3D plots, such as those generated by ListPointPlot3D.

For example, you can use PlotStyle to set the color of points generated by ListPointPlot3D:

 Out[63]=

You can also use color gradients with 3D plots. One way to use ColorFunction is to implement a predefined color gradient in the direction:

 Out[64]=