Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have the following Plot:

enter image description here

Apparently MMA uses ColorData[1,1] for the edges in all graphs. I already tried adding

ExclusionsStyle -> {ColorData[1, 1], ColorData[1, 2], ColorData[1, 3]}

but that doesn't help; it only uses the first listed color. Adding `Directive' only uses the last listed color:

ExclusionsStyle -> Directive[{ColorData[1, 1], ColorData[1, 2], Red}]]

Any idea how I can Plot the edges in the same colors as the graphs?

edit
The code, upon request:

sqw[x_, f_] := SquareWave[x f]/3;  
Plot[{sqw[x, 1] + 2.5, sqw[x, 0.95] + 1.5, -3 sqw[x, 1] sqw[x, 0.95] + 0.5}, {x, -1, 4},  
Axes -> False, PlotStyle -> {AbsoluteThickness[2]},  
ExclusionsStyle -> {ColorData[1, 1], ColorData[1, 2], ColorData[1, 3]}]
share|improve this question
1  
You may post the code you are using for generating those plots ... –  belisarius Jul 10 '12 at 8:31
add comment

1 Answer

up vote 4 down vote accepted

Perhaps

sqw[x_, f_] := SquareWave[x f]/3;
Plot[{sqw[x, 1] + 2.5, sqw[x, 0.95] + 1.5, -3 sqw[x, 1] sqw[x, 0.95] + 0.5}, {x, -1, 4}, 
         Axes -> False, PlotStyle -> {AbsoluteThickness[2]}, Exclusions -> False]

enter image description here

Edit

But you may find troubles if you need to specify a different Style for the exclusions in each function. For example, the following does not work as expected:

Plot[{2 + Floor[x], Floor[x]}, {x, 0, 4}, PlotStyle -> {Red, Blue}, 
 Exclusions -> True,  ExclusionsStyle -> {{Yellow, Green}, {White, Black}}]

enter image description here

share|improve this answer
    
Perhaps?? I'd say for sure! :-) Thanks a bunch! –  stevenvh Jul 10 '12 at 8:57
    
For those wondering what happened to the first spikes on the 3th function: I cleaned up the functions a bit (rounded numbers and such) :-) –  stevenvh Jul 10 '12 at 9:33
    
The obvious question for the Floor addition is: is there a fix? (probably not an easy one, otherwise you would probably have added it) –  stevenvh Jul 10 '12 at 13:09
    
@stevenvh Obviously not :) –  belisarius Jul 10 '12 at 23:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.