Message Boards Message Boards

GROUPS:

Set PlotStyle to distinguish 6 lines without using colors? Dotted, Dashed..

Posted 3 months ago
865 Views
|
13 Replies
|
12 Total Likes
|

If I have a plotting with 6 lines and I want to distinguish between them without colours, like (Dotted, Dashed, DotDashed). What's about the other three lines?

Attachments:
13 Replies

You may want to try

Plot[{B1[z], B2[z], B3[z], B4[z], B5[z], B6[z]}, {z, -0.3, 0.3}, 
 AxesLabel -> {"z(mm)", "Magnetic Field at(Bo=0.01T)"}, 
 AxesStyle -> Thick, 
 PlotStyle -> ({Black, #} & /@ {Thick, Dotted, Dashed, DotDashed, Dotted, Dashed})]

Is it that what you wanted?

Yes like this but here the utilization of (Dotted and Dashed) in twic time. I want every line different from other in the form.

Maybe this helps:

Website1

Website2

These examples Just for 3 lines.

If we have 6 lines how can we distinguish between them??? 1- Dotted 2-Dashed 3-DotDashed 4-Normal line(Black) 5-.........???? 6-..........????

Perhaps like this? (To be properly modified!)

f1 = x^2;
f2 = x^3;
t1 = Table[Text[1, {j - 1, f1 /. x -> j - 1}], {j, 0, 5, .4}];
t2 = Table[Text[2, {j - 1, f2 /. x -> j - 1}], {j, 0, 5, .4}];
p1 = Plot[{f1, f2}, {x, 0, 4}];
Show[p1, Graphics /@ {t1, t2}]

Dear Dr. Hans, Thanks for your time and your help.

Everything in my previous attached file is true. But the simple problem is these six lines In the plot how I can make them different from each other.

Until now I know just 4 properties (Dotted, Dashed, DotDashed, Thick). I just need another two properties to complete my six line.

Thank you very much

Dear Aymen. Obviously you dont like the numbers written to the lines in the plot. OK. But remember: Mariusz already pointed out two websites where it is shown how you can make your own styles.

To give you an example ("quick and dirty"): I define two frames by the number .2, a spacer by .05 and then a "binary code" with 0 and 0.1.

The first line gets the code 0 , meaning {0,0,0} or { frame, space, 0, space, 0, space, 0, frame}, the second code 1 and so on, the sixth line code 5 or { 1, 0, 1}. And I use a factor f to play around with the plots.

Altogether I define

f = .1;
d1 = f {.2, .05, 0, .05, 0, .05, 0, .05, .2};
d2 = f {.2, .05, .1, .05, 0, .05, 0, .05, .2};
d3 = f {.2, .05, 0, .05, .1, .05, 0, .05, .2};
d4 = f {.2, .05, 0, , 05, 0, .05, .1, .05, .2};
d5 = f {.2, .05, .1, .05, .1, .05, 0, .05, .2};
d6 = f {.2, .05, .1, .05, 0, .05, .1, .05, .2};

Now try (I had to eliminate some of your code because it doesn't work with my version Mma 7)

Plot[{B1[z], B2[z], B3[z], B4[z], B5[z], B6[z]}, {z, -0.3, 0.3}, 
 AxesLabel -> {"z(mm)", "Magnetic Field at(Bo=0.01T)"}, 
 AxesStyle -> Thick, PlotStyle -> Dashing /@ {d1, d2, d3, d4, d5, d6}]

Is it that what you wanted to see?

And of course you may modify the d's according to your own taste.

Thanks, Dr Hans

That was very useful to me.

Posted 3 months ago

The "Monochrome" plot theme will generate 6 distinct plot styles without further input:

Plot[{B1 @ z, B2 @ z, B3 @ z, B4 @ z, B5 @ z, B6 @ z},
    {z, -0.3, 0.3},
    PlotTheme -> "Monochrome", PlotLegends -> "Expressions"
] 

enter image description here

Dear Jason Biggs,

Can you send the code in the attached file, please?

This could be a working case accordint to Jason:

Plot[{Sin[z], Sin[2 z], Sin[3 z], Sin[4 z], Sin[5 z], 
  Sin[6 z]}, {z, -0.3, 0.3}, PlotTheme -> "Monochrome", 
 PlotLegends -> "Expressions"]
Posted 2 months ago

Can you send the code in the attached file, please?

The notebook you posted above defines the functions B1 through B6, and the plotting is done using the code in my post.

Without knowing anything about the graphics standards you have to work to, and steeped in the study of Tufte, my personal preference would be, FWIW:

Plot[{B1@z, B2@z, B3@z, B4@z, B5@z, B6@z}, {z, -0.3, 0.3}, 
 PlotStyle -> Table[GrayLevel[0.1 + 0.13 j], {j, 1, 6}], 
 PlotLegends -> {"d = 0.1mm", "d = 0.09mm", "d = 0.08mm", 
   "d = 0.07mm", "d = 0.06mm", "d = 0.05mm"}
 , LabelStyle -> "Background" -> White, 
 AxesLabel -> {"z(mm)", "Magnetic Field at(Bo=0.01T)"}]

Cheers, Fred

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract