Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Dear users I am a new member here and I would like to ask a question about PlotLegends.

I have multiple curves and want to make their legends bit more visible. Here is a sample code:

Plot[{Sin[h], Cos[h], Tan[h]}, {h, 5, 10}, 
  PlotStyle -> {{GrayLevel[0], Dashing[None],Thickness[0.005]}, 
                {GrayLevel[0], Dashing[0.01],Thickness[0.005]}, 
                {GrayLevel[0], Dashing[0.02],Thickness[0.005]}, 
                {GrayLevel[0], Dashing[0.03],Thickness[0.005]}}, 
  Axes -> False, Frame -> True,
  PlotLegends -> Placed[{"sin", "cos", "tan"}, Top]]

I assume that the problem comes from the Dashing[] specifications making the legends line not visible enough.I may have up to 7 curves so i need and alternative to Dashing[] or any other way to increase lengths of legends and make them more visible.

share|improve this question
1  
Welcome to MMA.SE! What do you mean by "a bit more visible"? If you can post some code you already tried, then all the better. Otherwise it might be difficult to answer your question properly. –  Yves Klett Aug 13 '13 at 9:17
    
You can try here if you are using PlotLegend on a version of Mathematica < 9. –  Öskå Aug 13 '13 at 9:32
    
i applied standard PlotLegend; and i was sure every body would know that the legends created by it are too short and dashing is not visible at all in most of the cases. i want to know if i could increase the length of these legends. i have read something about legendmaker in this forum but i couldn't figure it our well. i cannot customize it for my problem so i will be really thankful if someone can guide me in that. –  naveed Aug 13 '13 at 9:32
1  
As Yvers Klett said you should edit your question and add the PlotLegends that you used. –  Öskå Aug 13 '13 at 9:48
1  
@yves I'm glad someone is still remembering to welcome new users! –  cormullion Aug 13 '13 at 10:06
show 4 more comments

1 Answer

up vote 2 down vote accepted

The scaling of the Dashing gets messed up a little, therefore I suggest the following:

Plot[{Sin[h], Cos[h], Tan[h]}, {h, 5, 10}, 
      PlotStyle -> {
        {GrayLevel[0], Dashing[None], Thickness[0.005]}, 
        {GrayLevel[0], Dashing[Tiny], Thickness[0.005]}, 
        {GrayLevel[0], Dashing[Small],Thickness[0.005]}, 
        {GrayLevel[0], Dashing[Medium],Thickness[0.005]}}, 
      Axes -> False, Frame -> True, 
      PlotLegends -> Placed[
                      LineLegend[
                        Automatic, {"sin", "cos", "tan"}, 
                        LegendMarkerSize -> {{45, 15}}],
                      Top]
     ]

LegendMarkerSize increases the Length of the Legend lines and {Tiny,Small,Medium} instead of numeric arguments transfer properly to the Legend.

enter image description here

share|improve this answer
    
Dear i think it solves my problem, but can you please tell me full list of these styles,i mean Tiny,Small,Medium then what? big or larg? please if you can tell me 7 of these my problem will be solves –  naveed Aug 13 '13 at 11:16
    
Here i had 4 dashing styles; I need 3 more please let me know about them as well. –  naveed Aug 13 '13 at 11:26
    
Have a look at the documentation of Dashing here reference.wolfram.com/mathematica/ref/Dashing.html. You only get four with Tiny, Small, Medium, Large (see Details section of page), but you can just specify r manually or a series of these (for different dash size patterns). –  Jonie Aug 13 '13 at 11:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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