To get a legend guide when using scale_identity we need to specify guide = "legend". In addition, "you'll typically* also need to supply breaks and labels" (?scale_identity).
However, when trying to get legends for color, fill, shape, size and alpha, when using scale_identity, a correct legend is obtained only for color. All other aesthetics generate either an incorrect legend (fill) or an error (shape, size and alpha).
To get a legend guide when using
scale_identity
we need to specifyguide = "legend"
. In addition, "you'll typically* also need to supplybreaks
andlabels
" (?scale_identity
).However, when trying to get legends for
color
,fill
,shape
,size
andalpha
, when usingscale_identity
, a correct legend is obtained only forcolor
. All other aesthetics generate either an incorrect legend (fill
) or an error (shape
,size
andalpha
).Some data:
Then try to get legends, without and with specification of
labels
andbreaks
.Legends for
color
andfill
:The plot itself looks OK for all aesthetics. The legend for
color
is OK, but thefill
legend only displays black points.Legend for
shape
errors (Error: Continuous value supplied to discrete scale
)Legends for
size
andalpha
error (Error in !self$na.translate : invalid argument type
)By accident, I also mapped
alpha
while specifying asize
legend, resulting in analpha
legend:* It's unclear what 'typically' means here. At least in my examples, including or excluding
labels
andbreaks
makes no difference.The text was updated successfully, but these errors were encountered: