There are many ways to what you ask. Here are two.
Plot[{2 x + 2, 4 x}, {x, 0, 2},
PlotStyle -> ({Black, Dashing[#]}& /@ {Large, Medium})]
Plot[{2 x + 2, 4 x}, {x, 0, 2},
ColorFunction -> (Black&),
PlotStyle -> {{Dashing @ Large}, {Dashing @ Medium}}]
Both of the above expressions produce the following plot.
Generalization
I am moved to discuss a more general case that seems to come up quite a lot. This is when there are several functions or expression to plot in one panel and all are to have a common plot style except for one which requires custom styling to focus attention on it. I also want to make it easy to experiment with both the default styling and the call-out styling.
My approach will be to generalize the first example I gave above.
Let a number of expressions be given for plotting and assume the 3rd expression is the one that needs a call-out.
I will choose four expressions for this example, but will not rely on knowing that number in the following code.
lines = # x & /@ Range[4]
{x, 2 x, 3 x, 4 x}
The default style for the lines will be black color, absolute thickness specification of 2 pts, and absolute dashing specification {3, 5}
, also in pts. The call-out style will be red, 3 pts, and {6,,10}
.
styleDefaults = {Black, 1.5, {3, 5}};
callOut = 3 -> {Red, 3, {6, 10}};
Note I use a rule to specify the call-out. That is because I am going to insert it with ReplacePart
as you will now see.
styleData = ReplacePart[ConstantArray[styleDefaults, Length[lines]], callOut]
The plot is then made like so:
Plot[lines, {x, 0, 2},
PlotStyle -> (
{#[[1]], AbsoluteThickness[#[[2]]], AbsoluteDashing[#[[3]]]} & /@ styleData)]
Of course, if this were working code and not a tutorial, everything would be wrapped in a Module
expression to localize the auxiliary variables..
Module[{lines, styleDefaults, callOut, styleData},
lines = # x & /@ Range[4];
styleDefaults = {Black, 1.5, {3, 5}};
callOut = 3 -> {Red, 3, {6, 10}};
styleData =
ReplacePart[ConstantArray[styleDefaults, Length[lines]], callOut];
Plot[lines, {x, 0, 2},
PlotStyle ->
({#[[1]], AbsoluteThickness[#[[2]]], AbsoluteDashing[#[[3]]]} & /@ styleData)]]