Graphs with different colors

Posted 9 years ago
4946 Views
|
3 Replies
|
2 Total Likes
|
 Hi,This should be not that hard, but I tried many different ways, I can't figure it out. If you can take a quick look and help me, it would be very appreciable.As you see in the code, I have three plots, but they are all in same colors. How can I make them different? Clear[x] L1 = 10; L2 = {30, 40, 48}; f[x_] = 100 (100/x)^(-(L2/L1)); Plot[f[x], {x, 90, 100}, PlotStyle -> Dashed, PlotStyle -> {Black, Red, Blue}, AxesLabel -> {"10mm transmittance (%)", "target transmittance (%)"}] Print["Sample thickness(mm)= ", L1] Print["Target thickness(mm)= ", L2] Thank you so much in advance.
3 Replies
Sort By:
Posted 9 years ago
 Hi Eric and Bianca, Thank you so much for your help. I really appreciate it.
Posted 9 years ago
 ... what Eric said. However, that alone will give you the first three default colours, not the ones you specify in your code. The problem here is that you give the PlotStyle option twice, but Mathematica will only interpret the first instance of any option. This means that you have to combine Dashed and the colours in the same PlotStyle option, like this: Clear[x] L1 = 10; L2 = {30, 40, 48}; f[x_] = 100 (100/x)^(-(L2/L1)); Plot[Evaluate[f[x]], {x, 90, 100}, PlotStyle -> {Directive[Dashed, Black], Directive[Dashed, Red], Directive[Dashed, Blue]}, AxesLabel -> {"10mm transmittance (%)", "target transmittance (%)"}] Print["Sample thickness(mm)= ", L1] Print["Target thickness(mm)= ", L2] 
Posted 9 years ago
 Change the first argument of Plot from f[x] to Evaluate[f[x]].