I upload data using the following code
data = Import["L" <> # <> ".dat"] &/@{"10", "102",
"103", "104"};
My function is
W[L_, r_] := 1 + 3 L + 2 L^2 - 6 r*L - 6 L (r*L) + 6 (r*L)^2;
Tu[L_, r_, d_, koff_, u_, W_] := ((u/d^2)* W[L, r]+6 u (L - 1)) + koff ((u/d^2) W[L, r]+6L*u)
I try to plot my function and would like to use the same trick for Plot Legend as I used for uploading data
LVals = {10, 10^2, 10^3, 10^4};
Show[LogLogPlot[
Evaluate@Table[Tu[n, 0.5, d, 10^3, 10^5, W], {n, LVals}], {d, 0.01,
10^7}, AxesLabel -> {"d", "T"},
PlotLabel -> "T vs d", PlotLegends ->
"L ="<> # &/@LVals, ListLogLogPlot[data],
PlotStyle -> {Red, Blue, Green, Black}]
But it gives the following message:
"Options expected (instead of !(((PlotLegends -> \"L = \" <> #1 &)\ ) /@ LVals)) beyond position 2 in LogLogPlot"
The following code works
Show[LogLogPlot[Evaluate@Table[Tu[n, 0.5, d, 10^3, 10^5, W], {n, LVals}],{d,0.01, 10^7},
AxesLabel -> {"d", "T"}, PlotLabel -> "T vs d", PlotLegends ->LVals], ListLogLogPlot[data],
PlotStyle -> {Red, Blue, Green, Black}]
and gets the legend as
10 100 1000 10000
But I want the legend as
L=10 L=100 L=1000 L=10000
How should I do this?
p.s. Why do I also obtain the message:
OptionValue::nodef: "Unknown option !(\"PlotStyle\") for Graphics."
a -> b[#]& /@ c
is(a -> b[#])& /@ c
instead ofa -> (b[#]& /@ c)
$\endgroup$ – Brett Champion Nov 5 '15 at 20:00Plot
holds its arguments, so theMap
doesn't even evaluate (otherwise you'd get a list ofPlotLegend -> ...
and be wondering why you legend shows up wrong.) $\endgroup$ – Brett Champion Nov 5 '15 at 20:02PlotStyle
is only an option forPlot
, butGraphics
(which is whatShow
is working with) doesn't know anything about it. (UnlikePlotRange
andPlotLabel
, which are general graphics options.) $\endgroup$ – Brett Champion Nov 5 '15 at 20:04L
for data and plotting curve? $\endgroup$ – Mary Nov 5 '15 at 20:45PlotStyle
in bothLogLogPlot
andListLogLogPlot
. $\endgroup$ – Brett Champion Nov 5 '15 at 21:03