4
$\begingroup$

How to plot the function f(x) so that one part be a thicker line than another depending on the value x? (Curve is efficient frontier - portfolio optimization)

$\endgroup$
2
  • $\begingroup$ All kinds of ways to skin that cat, a quick-n-dirty way is something like this: Plot[Sin[x], {x, 0, 10}, Epilog -> Plot[Sin[x], {x, 3, 5}, PlotStyle -> Thickness[.01]][[1]]] $\endgroup$
    – ciao
    Feb 1 '14 at 4:54
  • $\begingroup$ @MichaelE2: That is a sweet answer from you in that link. $\endgroup$
    – ciao
    Feb 1 '14 at 5:08
5
$\begingroup$
Plot[Sin[x], {x, 0, 2 Pi}, PlotPoints -> 300] /.  Line[x_] :> Line /@ Partition[x, 2, 1] /. 
                                     Line[x_] :> {Thickness[.02 Abs@x[[1, 2]]], Line[x]}

Mathematica graphics

$\endgroup$
2
  • $\begingroup$ You have not only skinned that cat, you've made a fur-covered Bentley out of it. +1 $\endgroup$
    – ciao
    Feb 1 '14 at 5:09
  • $\begingroup$ @rasher Slightly better now $\endgroup$ Feb 1 '14 at 11:39

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