2 replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/ edited Apr 13 '17 at 12:56 Another way is to split up the Piecewise function into pieces and use ConditionalExpression. getPieces[f_Piecewise] := Append[ConditionalExpression @@@ First@ f, ConditionalExpression[Last@ f, ! Or @@ f[[1, All, 2]]]]  Borrowing an example from http://mathematica.stackexchange.com/questions/96337/plotting-piecewise-functions-with-distinct-colors-issue-foundPlotting piecewise functions with distinct colors - issue found, we can plot it as follows. (Note ColorData[100] is from V10. Another color scheme may be used of course.) pw = Piecewise[{ {7.95*^6 + x (0.0307 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 0 <= x <= 7157200}, {8.01*^6 + x (0.0220 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 7157200 <= x <= 14314400}, {8.05*^6 + x (0.0190 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 14314400 <= x <= 21471600}, {8.07*^6 + x (0.0180 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 21471600 <= x <= 28628800}, {8.08*^6 + x (0.0179 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 28628800 <= x <= 35786000}}, 0]; Plot[Evaluate[getPieces[pw]], {x, 0, 35786000}, PlotStyle -> ColorData[100]]  Note that for this particular code, one might use ConditionalExpression more directly with Plot[Evaluate[ConditionalExpression @@@ First@pw], {x, 0, 35786000}, PlotStyle -> ColorData[100]]  since the default is not used over this interval. One can also apply PiecewiseExpand to pw in cases where the inequalities might need simplifying; PiecewiseExpand might also reorder the pieces. (It does on pw.) Another way is to split up the Piecewise function into pieces and use ConditionalExpression. getPieces[f_Piecewise] := Append[ConditionalExpression @@@ First@ f, ConditionalExpression[Last@ f, ! Or @@ f[[1, All, 2]]]]  Borrowing an example from http://mathematica.stackexchange.com/questions/96337/plotting-piecewise-functions-with-distinct-colors-issue-found, we can plot it as follows. (Note ColorData[100] is from V10. Another color scheme may be used of course.) pw = Piecewise[{ {7.95*^6 + x (0.0307 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 0 <= x <= 7157200}, {8.01*^6 + x (0.0220 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 7157200 <= x <= 14314400}, {8.05*^6 + x (0.0190 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 14314400 <= x <= 21471600}, {8.07*^6 + x (0.0180 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 21471600 <= x <= 28628800}, {8.08*^6 + x (0.0179 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 28628800 <= x <= 35786000}}, 0]; Plot[Evaluate[getPieces[pw]], {x, 0, 35786000}, PlotStyle -> ColorData[100]]  Note that for this particular code, one might use ConditionalExpression more directly with Plot[Evaluate[ConditionalExpression @@@ First@pw], {x, 0, 35786000}, PlotStyle -> ColorData[100]]  since the default is not used over this interval. One can also apply PiecewiseExpand to pw in cases where the inequalities might need simplifying; PiecewiseExpand might also reorder the pieces. (It does on pw.) Another way is to split up the Piecewise function into pieces and use ConditionalExpression. getPieces[f_Piecewise] := Append[ConditionalExpression @@@ First@ f, ConditionalExpression[Last@ f, ! Or @@ f[[1, All, 2]]]]  Borrowing an example from Plotting piecewise functions with distinct colors - issue found, we can plot it as follows. (Note ColorData[100] is from V10. Another color scheme may be used of course.) pw = Piecewise[{ {7.95*^6 + x (0.0307 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 0 <= x <= 7157200}, {8.01*^6 + x (0.0220 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 7157200 <= x <= 14314400}, {8.05*^6 + x (0.0190 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 14314400 <= x <= 21471600}, {8.07*^6 + x (0.0180 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 21471600 <= x <= 28628800}, {8.08*^6 + x (0.0179 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 28628800 <= x <= 35786000}}, 0]; Plot[Evaluate[getPieces[pw]], {x, 0, 35786000}, PlotStyle -> ColorData[100]]  Note that for this particular code, one might use ConditionalExpression more directly with Plot[Evaluate[ConditionalExpression @@@ First@pw], {x, 0, 35786000}, PlotStyle -> ColorData[100]]  since the default is not used over this interval. One can also apply PiecewiseExpand to pw in cases where the inequalities might need simplifying; PiecewiseExpand might also reorder the pieces. (It does on pw.) 1 answered Jan 6 '16 at 17:41 Michael E2 160k1313 gold badges219219 silver badges519519 bronze badges Another way is to split up the Piecewise function into pieces and use ConditionalExpression. getPieces[f_Piecewise] := Append[ConditionalExpression @@@ First@ f, ConditionalExpression[Last@ f, ! Or @@ f[[1, All, 2]]]]  Borrowing an example from http://mathematica.stackexchange.com/questions/96337/plotting-piecewise-functions-with-distinct-colors-issue-found, we can plot it as follows. (Note ColorData[100] is from V10. Another color scheme may be used of course.) pw = Piecewise[{ {7.95*^6 + x (0.0307 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 0 <= x <= 7157200}, {8.01*^6 + x (0.0220 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 7157200 <= x <= 14314400}, {8.05*^6 + x (0.0190 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 14314400 <= x <= 21471600}, {8.07*^6 + x (0.0180 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 21471600 <= x <= 28628800}, {8.08*^6 + x (0.0179 - 2.1558*^-11 x - 1.1279*^-18 x^2) - 507300. Log[6.371*10^6 + 1. x], 28628800 <= x <= 35786000}}, 0]; Plot[Evaluate[getPieces[pw]], {x, 0, 35786000}, PlotStyle -> ColorData[100]]  Note that for this particular code, one might use ConditionalExpression more directly with Plot[Evaluate[ConditionalExpression @@@ First@pw], {x, 0, 35786000}, PlotStyle -> ColorData[100]]  since the default is not used over this interval. One can also apply PiecewiseExpand to pw in cases where the inequalities might need simplifying; PiecewiseExpand might also reorder the pieces. (It does on pw.)