How do I change the colormap of a multiline plot and have it change the colors of the existing lines? I am using Matlab 2018b. Here is a simple example.
x = rand(10,1000);t = 0:999;plot(t, x)colormap wintercolormap whitecolormap flagfh = gcf;fh.Colormap = colormap('flag');fh.Children(1).Colormap = colormap('flag');
For me, the colors of the lines do not change. The following also did not work, the lines are plotted using the "default" color scheme.
fh2 = figure;fh2.Colormap = colormap('flag');ax = axes(fh);ax = axes(fh2);ax.Colormap = colormap('flag');plot(ax, t, x)
Invoking "colorbar" shows a colorbar using the desired colormap. Using colormap with surf(peaks) does change the color of that plot. How do I change the colormap of a 2D multiline plot?
Best Answer