X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 25 Apr 2017 03:10 PM by  David Starbuck
Question about IDL Legend
 0 Replies
Sort:
You are not authorized to post a reply.
Author Messages

David Starbuck



Basic Member


Posts:143
Basic Member


--
25 Apr 2017 03:10 PM
    Question from customer:

    Is there any way to mix a line and a single symbol in a legend? You can reduce the number of symbol by setting the SAMPLE_WIDTH to zero, but then the line will disappear.

    Possible Answer:

    Unfortunately, I think the only way to reduce the number of symbols is by adjusting the SAMPLE_WIDTH. You can then use the POLYLINE routine to manually draw the line onto the legend:

    IDL> theory = SIN(2.0*FINDGEN(201)*!PI/25.0)*EXP(-0.02*FINDGEN(201))
    IDL> observed = theory + RANDOMU(seed,201)*0.4-0.2
    IDL> plot1 = PLOT(observed, 'b2', NAME='Observed', symbol='star')
    IDL> plot2 = PLOT(theory, /OVERPLOT, 'r2', NAME='Theory')
    IDL> leg = LEGEND(TARGET=[plot1,plot2], POSITION=[185,0.9],/DATA, /AUTO_TEXT_COLOR, SAMPLE_WIDTH=0.0)
    IDL> p = polyline([.73,.75], [.62,.62],/NORMAL, COLOR='red')

    NOTE: I figured out the location of the POLYLINE empirically.

    -David
    Harris GS
    You are not authorized to post a reply.