This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
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:
Click for copyable input
Use ListPlot and PlotMarkers to plot the data with an asterisk for data points:
Click for copyable input
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:
Click for copyable input
Use the graphic you just created as a plot marker with a size of :
Click for copyable input
To change the color of points in a plot, use the PlotStyle option. Here, the color Red is specified:
Click for copyable input
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 :
Adding additional datasets to your plots and styling them requires little additional work.
First, define some datasets that you will plot:
Click for copyable input
Plot the data using ListPlot:
Click for copyable input
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:
Click for copyable input
Change the colors from the default scheme by using PlotStyle with similar syntax:
Click for copyable input
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:
Click for copyable input
You can also use color gradients with 3D plots. One way to use ColorFunction is to implement a predefined color gradient in the direction:
Click for copyable input