How to | Change the Type and Color of Points in a 2D Scatter Plot
While the default settings for plots created in the Wolfram Language 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, the Wolfram Language also lets you change the color and type of marker for points.
The Wolfram Language 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:
Use ListPlot and PlotMarkers to plot the data with an asterisk for data points:
The Wolfram Language 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:
Use the graphic you just created as a plot marker with a size of .07:
To change the color of points in a plot, use the PlotStyle option. Here, the color Red is specified:
Any of the colors supported by the Wolfram Language 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 r, g, and b:
Adding additional datasets to your plots and styling them requires little additional work.
First, define some datasets that you will plot:
Plot the data using ListPlot:
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, {●,10} specifies the point type and size for the dataset testData1, and so on. The markers come from the Special Characters palette:
Change the colors from the default scheme by using PlotStyle with similar syntax:
The Wolfram Language 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:
You can also use color gradients with 3D plots. One way to use ColorFunction is to implement a predefined color gradient in the direction: