From: julia.strassburg on
For a 2D Plot in Mathematica: How can I modify the line thickness in
the legend of a 2D Plot. The lines in the plot can be made thickner
through PlotStyle->{Thickness[0.08]}, but this does not influence the
legend. How can I change the line thickness there?

From: David Annetts on
Hi Julia,
>
> For a 2D Plot in Mathematica: How can I modify the line
> thickness in the legend of a 2D Plot. The lines in the plot
> can be made thickner through PlotStyle->{Thickness[0.08]},
> but this does not influence the legend. How can I change the
> line thickness there?

You can control line thickness settings in a legend by making your own. For
example, whereas you might have something like

Plot[{Sin[x], Cos[x]}, {x, -Pi, Pi}, PlotStyle -> {Red, Blue},
LegendLabel -> StyleForm["Legend", FontSlant -> "Oblique", FontWeight ->
"Bold", FontSize -> 12],
PlotLegend -> {"Sin[x]", "Cos[x]"}, LegendShadow -> None,
LegendSize -> {.5, .20}, LegendPosition -> {-.8, .35}
];

You'll need to construct a legend manually like

lin = Graphics[{ #, Thickness[.2], Line[{{-1, 0}, {1, 0}}]}] & /@ {Red,
Blue};
txt = {"Sin[x]", "Cos[x]"};
lgd = {Transpose[{lin, txt}],
LegendLabel -> StyleForm["Legend", FontSlant -> "Oblique", FontWeight
->"Bold", FontSize -> 12],
LegendShadow -> None,
LegendSize -> {.5, .20},
LegendPosition -> {-.8, .35}
};

You can use this with the ShowLegend[] command

plt = Plot[{Sin[x], Cos[x]}, {x, -Pi, Pi},
PlotStyle -> {Red, Blue}, DisplayFunction -> Identity
];
ShowLegend[plt, lgd];

The critical thing is the graphics primitives in the legend line (lin = in
the example above).

Regards,

Dave.

From: Bob Hanlon on
Use AbsoluteThickness

Needs["Graphics`"];

m=3;

Plot[Evaluate[
Table[x^n,{n,0,m}]],{x,0,1.2},
PlotStyle->Table[
{AbsoluteThickness[n+1],
Hue[(n+m)/(2m)]},{n,0,m}],
PlotLegend->Table[n,{n,0,m}],
ImageSize->480];


Bob Hanlon

---- julia.strassburg(a)gmx.de wrote:
> For a 2D Plot in Mathematica: How can I modify the line thickness in
> the legend of a 2D Plot. The lines in the plot can be made thickner
> through PlotStyle->{Thickness[0.08]}, but this does not influence the
> legend. How can I change the line thickness there?
>

From: David Park on
Thickness is proportional to the size of the frame, and of the legend box so
that the same Thickness does not come out the same in the two places.

Use AbsoluteThickness.

David Park
djmp(a)earthlink.net
http://home.earthlink.net/~djmp/

From: julia.strassburg(a)gmx.de [mailto:julia.strassburg(a)gmx.de]


For a 2D Plot in Mathematica: How can I modify the line thickness in
the legend of a 2D Plot. The lines in the plot can be made thickner
through PlotStyle->{Thickness[0.08]}, but this does not influence the
legend. How can I change the line thickness there?


From: dimmechan on

julia.strassburg(a)gmx.de :
> For a 2D Plot in Mathematica: How can I modify the line thickness in
> the legend of a 2D Plot. The lines in the plot can be made thickner
> through PlotStyle->{Thickness[0.08]}, but this does not influence the
> legend. How can I change the line thickness there?

I have searched a lot to do what you want but I failed.
However, if you executed the following command you will see that Epilog

may be helpful for you.

Plot[{BesselJ[0, x], BesselJ[1, x], BesselJ[2, x]}, {x, 0, 10}, Frame
->
True, Axes -> False, PlotStyle -> {{Thickness[0.008],
Dashing[{0.04, 0.04}]}, Thickness[0.005], Thickness[0.009]},
FrameStyle -> Thickness[
0.004], FrameLabel -> {"x
", TraditionalForm[BesselJ[n, x]]}, TextStyle -> {FontFamily
-> "
Times", FontWeight -> "Bold", FontSize -> 14}, PlotLabel ->
"Bessel \
plots", Epilog -> {{Text["n=0", {8, 0.5}]}, {Text["n=1", {8, 0.7}]}, {
Text["n=2", {8, 0.9}]}, {
Thickness[0.005], Line[{{6.3, 0.7}, {7.3, 0.7}}]},
{Thickness[0.008],
Line[{{6.3,
0.5}, {6.7, 0.5}}]}, {
Thickness[0.008], Line[{{7, 0.5}, {7.3, 0.5}}]}, {
Thickness[0.009], Line[{{6.3, 0.9}, {7.3, 0.9}}]}}]

Cheers,
Jim