3
$\begingroup$

This question already has an answer here:

I have two parametric space curves with different line styles plotted with ParametricPlot3D, with a ColorFunction applied. How do I get a plot legend to label the different lines? Without the ColorFunction PlotLegends works as normal, but with it, no legend is plotted.

$\endgroup$

marked as duplicate by eyorble, m_goldberg plotting Sep 1 '18 at 2:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ I wonder, if it is a bug. $\endgroup$ – Johu Aug 30 '18 at 21:37
  • 1
    $\begingroup$ duplicate?: PlotLegend disappears if Plot is used with ColorFunction $\endgroup$ – kglr Aug 30 '18 at 22:22
  • 2
    $\begingroup$ this is a bug in versions 10+. It works in version 9 although the legend liness do not have gradient coloring. $\endgroup$ – kglr Aug 30 '18 at 22:25
4
$\begingroup$

Use Legended

Legended[
 ParametricPlot3D[{
   {Sin[u], Cos[u], u/10},
   {Sin[2 u], Cos[3 u], u/5}},
  {u, 0, 20},
  PlotStyle -> {{AbsoluteThickness[4]}, {Thick, Dashed}},
  ColorFunction -> Function[{x, y, z, u}, Hue[u]]],
 LineLegend[
  {Thick, Dashed},
  {"{Sin[u],Cos[u],u/10}", "{Sin[2u],Cos[3u],u/5}"}]]

enter image description here

$\endgroup$

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