Dear all I have such data temp <- structure(list(x = c(1.22640164371796, 2.06054252402081, 0.648406692116093, 0.502688462027622, 1.20971015442933, -1.33912870469085, 1.04053747125611, 1.08845105918041, 1.6409121019292, 0.596150765260052, 1.78013122654094, 0.4709422376346), y = c(9.09784917753244, 13.504613667029, 6.32295145782312, 4.91330174840941, 9.64505500251317, -4.36103528399272, 7.24123291486505, 9.71909654124553, 9.95890922449066, 5.50184347916369, 11.9072994677964, 5.42938848141327), a = c("b", "b", "b", "b", "b", "b", "a", "a", "a", "a", "a", "a"), b = c("e", "e", "f", "f", "e", "e", "f", "f", "f", "f", "f", "f"), c = c("j", "j", "j", "k", "k", "k", NA, NA, NA, NA, NA, NA), d = c("o", "o", "o", "o", "o", "o", "o", "o", "p", "p", "p", "p")), .Names = c("x", "y", "a", "b", "c", "d"), row.names = c(NA, 12L), class = "data.frame") and I can make ggplot with colour, shape, and size for variables a,b, and c. p <- ggplot(temp, aes(x=x, y=y, colour=c, shape=b, size=a)) p+geom_point()+geom_smooth(method="lm", size=1, se=FALSE)+scale_size_discrete(range = c(2, 4)) Some values are missing for variable "c" and I would like to mark them by variable "d" let say by plotting different shape based on value in this variable d. Actually I can tune this variable to have missing values if necessary. I thought that something like that can do it p1 <- p+geom_point()+geom_smooth(method="lm", size=1, se=FALSE)+scale_size_discrete(range = c(2, 4)) p1 + geom_point(data=temp, aes(x=x, y=y, shape=d)) ) However I need to have separate legends for variable b and d respectively so that these values do not mix together. To make it short, I need two different legends for shape for 2 variables in one plot. Any hints? Petr ________________________________ Tento e-mail a jak?koliv k n?mu p?ipojen? dokumenty jsou d?v?rn? a jsou ur?eny pouze jeho adres?t?m. Jestli?e jste obdr?el(a) tento e-mail omylem, informujte laskav? neprodlen? jeho odes?latele. Obsah tohoto emailu i s p??lohami a jeho kopie vyma?te ze sv?ho syst?mu. Nejste-li zam??len?m adres?tem tohoto emailu, nejste opr?vn?ni tento email jakkoliv u??vat, roz?i?ovat, kop?rovat ?i zve?ej?ovat. Odes?latel e-mailu neodpov?d? za eventu?ln? ?kodu zp?sobenou modifikacemi ?i zpo?d?n?m p?enosu e-mailu. V p??pad?, ?e je tento e-mail sou??st? obchodn?ho jedn?n?: - vyhrazuje si odes?latel pr?vo ukon?it kdykoliv jedn?n? o uzav?en? smlouvy, a to z jak?hokoliv d?vodu i bez uveden? d?vodu. - a obsahuje-li nab?dku, je adres?t opr?vn?n nab?dku bezodkladn? p?ijmout; Odes?latel tohoto e-mailu (nab?dky) vylu?uje p?ijet? nab?dky ze strany p??jemce s dodatkem ?i odchylkou. - trv? odes?latel na tom, ?e p??slu?n? smlouva je uzav?ena teprve v?slovn?m dosa?en?m shody na v?ech jej?ch n?le?itostech. - odes?latel tohoto emailu informuje, ?e nen? opr?vn?n uzav?rat za spole?nost ??dn? smlouvy s v?jimkou p??pad?, kdy k tomu byl p?semn? zmocn?n nebo p?semn? pov??en a takov? pov??en? nebo pln? moc byly adres?tovi tohoto emailu p??padn? osob?, kterou adres?t zastupuje, p?edlo?eny nebo jejich existence je adres?tovi ?i osob? j?m zastoupen? zn?m?. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email. In case that this e-mail forms part of business dealings: - the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning. - if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation. - the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects. - the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the person represented by the recipient.