Recent experimental and theoretical works have demonstrated that quantum mechanical effects play an important role in materials design of some novel nano-plasmonic materials. In this work, electronic structure calculations are used to study these effects for the optical properties of metal nanostructures and small flakes of graphene. Their optical response is shown to depend on their exact atomic composition, and their similarities (size-dependent resonance frequency) and differences (metallic vs. semiconducting material) are discussed. The open-source computer code GPAW is used for the simulations, which can be done for systems of thousands of valence electrons. The calculations automatically include quantum effects such as tunneling, nonlocal response, and molecular orbital hybridization.