Ista,
Thank you for your explain. Your first part answers make sense to me.
Later part still confused me.
geom_segment(aes(x = 10, y = 0, xend = 10, yend =
300,col="red",linetype="dashed"))
aes is for mapping variables to aesthetics. But here 10, 0, 10, 300,
"red" (x = 10, y = 0, xend = 10, yend = 300,col="red") should also be
constant. How can I understand this trick?
>> Dear list,
>>
>> I am enjoying to use ggplot2.
>>
>> But sometimes I found it is a bit of confused.
>>
>> For example, I just want to draw a segment. I use geom_segment.
>>
>> How can I know what kind of "linetype" I can use? Are there a full
>> list for "linetype" ?
>
> ?aes says
>
> "See Also:
>
> 'aes_string' for passing quoted variable names.
> 'aes_colour_fill_alpha', 'aes_group_order',
> 'aes_linetype_size_shape' and 'aes_position' for more specific
> examples with different aesthetics."
>
> ?aes_linetype_size_shape says
>
> " # Line types should be specified with either an integer, a name,
> or with a string of
> # an even number (up to eight) of hexidecimal digits which give
> the lengths in
> # consecutive positions in the string.
> # 0 = blank, 1 = solid, 2 = dashed, 3 = dotted, 4 = dotdash, 5 =
> longdash, 6 = twodash"
>
>>
>> Why this is not working?
>>
>> geom_segment(aes(x = 10, y = 0, xend = 10, yend =
>> 300,col="red",linetype="dashed"))
>
> aes is for mapping variables to aesthetics. "dashed" is not a
> variable, but a constant. In this case you should set it outside of
> the aes call, as you did below.
>
> HTH,
> Ista
>
>>
>> But this is OK.
>> geom_segment(aes(x = 10, y = 0, xend = 10, yend =
>> 300,col="red"),linetype="dashed")
>>
>> Thank you.
>>
--
Best wishes,
Jinyan HUANG