In Richard Matheson’s 1954 science fiction novel I Am Legend, Robert Neville is the sole surviving human following a plague possibly resulting from a war. Surrounded by a population of “vampires” or zombies, he survives their determined efforts at killing him by only leaving his house during daylight hours and killing every vampire he encounters sleeping in their darkened shelters. He also becomes determined to discover the exact cause of the plague that wiped out humanity and left its victims in this highly unusual states. Towards that end, he conducts a protracted and detailed study of the bacteria he believes may have been at the core of the plague.
Whether Robert Neville can be considered heroic is entirely a matter of perspective. Simply surviving when everyone else has succumbed to the deadly disease is not particularly heroic; it’s simply a matter of being fortunate enough to possess the antibodies required to resist infection. His scientific research isn’t particularly heroic, in that his determination to identify the strain of bacteria responsible for the disease is purely a matter of curiosity combined with the survival mechanism and natural inclination to seek a solution to a problem of overwhelming proportions. His treatment of the ultimately doomed dog is certainly humanitarian but, again, hardly rises to the level of heroism, and his encounters with Ruth don’t really amount to much, especially given the circumstances in which he finds himself at the novel’s end: contemplating his imminent demise and with it, the end of humanity. His final statement, “I am legend,” is uttered in recognition that he is the last human being who will likely ever walk the earth and, as such, will at most be considered an extinct species not unlike every other species driven to extinction.
Heroism is defined in terms of personal risk for the sake of others. Exposing oneself to mortal dangers so that others might survive is a heroic deed. In I Am Legend, Neville exposes himself to mortal dangers to the benefit of nobody in particular. He is the last representative of a species that may have itself to blame for its extinction; it is hard to categorize him as a hero.