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:
Use ListPlot and PlotMarkers to plot the data with an asterisk for data points:
Mathematica contains many special characters and symbols that can also be used as points in a plot. You can access these from the palette (located in the 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 :
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 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:
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, specifies the point type and size for the dataset , and so on. The markers come from the palette:
Change the colors from the default scheme by using PlotStyle with similar syntax:
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:
You can also use color gradients with 3D plots. One way to use ColorFunction is to implement a predefined color gradient in the direction: