m (Mathematica colours)
m
Line 20: Line 20:
 
<pre>
 
<pre>
 
Table[{Blend[{Red, Blue}, x]}, {x, 0, 1, 1/(n+1)}]
 
Table[{Blend[{Red, Blue}, x]}, {x, 0, 1, 1/(n+1)}]
 +
</pre>
 +
 +
In <tt>ListPlot</tt>, to have points (markers) have the same color as the lines (which should be the default), add:
 +
 +
<pre>
 +
PlotMarkers -> Graphics@{Point[{0, 0}]
 
</pre>
 
</pre>

Revision as of 14:24, 21 January 2021

Mathematica colours

Mathematica has a rather extensive support for colors, but more often than not, it needs tinkering with.

We like to use the SunsetColors color scheme:

ColorData["SunsetColors"]
Mathematica-SunsetColors.png

This module exports a list of n colors distributed along the gradient:

lcol[n_] := 
 Module[{}, Table[ColorData["SunsetColors"][i], {i, 0, 1, 1/(n - 1)}]]

A blending of colors can be done with blend, e.g., that generates a smooth transition from red to blue in n steps:

Table[{Blend[{Red, Blue}, x]}, {x, 0, 1, 1/(n+1)}]

In ListPlot, to have points (markers) have the same color as the lines (which should be the default), add:

PlotMarkers -> Graphics@{Point[{0, 0}]