I have following code,

ReImPlot[(2 + 3*I)*x + (4 + 5 I), {x, 0, 3}, ReImStyle -> {{Dashed, Red}, {DotDashed, Red}}]

This will created the plot that looks like this enter image description here

But I want both real and imaginary part to be colored red with Dashed and DotDashed curve respectively.


1 Answer 1


Unusually, Mathematica seems to have an ambiguous definition here. Normally, a list of directives is treated as a directive. But in this case, the list is interpreted (I guess) as directives to be applied to separate functions.

You can get round this by explicitly wrapping the directives with Directive, thus.

ReImPlot[(2 + 3*I)*x + (4 + 5 I), {x, 0, 3}, 
         ReImStyle -> {Directive[Dashed, Red], Directive[DotDashed, Red]}]

enter image description here

  • $\begingroup$ Thank you that actually works. However, now I cannot figure out how to put plotlegends? Can you add the plotlegend in the plot of your answer? $\endgroup$
    – sslucifer
    Mar 2 at 22:40
  • $\begingroup$ I suggest you ask another question. I'm going to bed now, but other people may be able to help. $\endgroup$
    – mikado
    Mar 2 at 22:58
  • $\begingroup$ @sslucifer PlotLegends -> Placed[Automatic, {.2, .9}] $\endgroup$
    – cvgmt
    Mar 2 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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