For a planar graph H, let N P (n, H) denote the maximum number of copies of H in an n-vertex planar graph. In this paper, we prove that N P (n, P 7 ) ∼ 4 27 n 4 , N P (n, C 6 ) ∼ (n/3) 3 , N P (n, C 8 ) ∼ (n/4) 4 and N P (n, K 4 {1}) ∼ (n/6) 6 , where K 4 {1} is the 1-subdivision of K 4 . In addition, we obtain significantly improved upper bounds on N P (n, P 2m+1 ) and N P (n, C 2m ) for m ≥ 4. For a wide class of graphs H, the key technique developed in this paper allows us to bound N P (n, H) in terms of an optimization problem over weighted graphs.