Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15136

Re: Multiple Line coloring and Dashing in ListPlot

From Alexei Boulbitch <Alexei.Boulbitch@iee.lu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Multiple Line coloring and Dashing in ListPlot
Date 2013-07-06 08:58 +0000
Message-ID <kr8m89$cr$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


Dear Mathematica Users,

I have a question about the coloring and dashing lines in listplot.
For example, Let's say there is a multiple data set like
data = Table[RandomReal[{2 i, 2 i + 1}, {20}], {i, 9}];

I want to plot them in listplot or listloglogplot with all different color and all different dashing with (joined -> True).
How can I do it automatically or minimum option?
The default number of coloring in mathematica (I am in still 8) is 4. after that, it repeat same color.

please help me!

Thanks!



There are several such possibilities to make different colors. The most straightforward is as follows:

data = Table[RandomReal[{2 i, 2 i + 1}, {20}], {i, 9}];

ListPlot[data, Joined -> True, PlotStyle -> Table[Hue[i/9], {i, 1, 9}]]

Try it.

You may use the RGBColor as well:

ListPlot[data, Joined -> True, PlotStyle -> Table[RGBColor[i/9, 0, 1 - i/9], {i, 1, 9}]]

try various combinations of colour variation: RGBColor[i/9, 0, 1], RGBColor[0, 0, 1 - i/9],
RGBColor[0, i/9, 1 - i/9] and so on. Try it.


You may as well use a ColorData:

ListPlot[data, Joined -> True, PlotStyle -> Table[ColorData[3, "ColorList"][i/9], {i, 1, 9}]]

and look, e.g. into ColorData  with different numbers.



However, if it is something I really care how it looks like, I do it "by hand":

ListPlot[data, Joined -> True, PlotStyle -> {Red, Blue, Green, Brown, Pink, Cyan, Magenta, Gray,
   Orange}]

You have also possibility of using Darker[ ] function:

ListPlot[data, Joined -> True,  PlotStyle -> {Red, Darker[Red, 0.5], Blue, Darker[Blue, 0.5], Green,
   Darker[Green, 0.5], Pink, Darker[Pink, 0.5], Cyan}]

 Try it.

Have fun. Alexei



Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch@iee.lu



Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Multiple Line coloring and Dashing in ListPlot Alexei Boulbitch <Alexei.Boulbitch@iee.lu> - 2013-07-06 08:58 +0000

csiph-web