Since you'll be driving San Francisco to Vancourver in May-July, I'd recommend not taking the coastal road (Highway 1) due to the ocean fog that can swamp the coastline during the warmer months - especially during the afternoon/evening as the inland heats up and draws the cool ocean air in.
If the weather is kind, then sure, go the coast, but you may find 101 better (there are some giant redwood forests around it as you get closer to Canada.)
There is a reason that people banter around a quote attributed to Mark Twain that goes "The coldest winter I ever saw was the summer I spent in San Francisco."
The best months for coastal driving in California are October through to April. Sometimes you can get lucky in early September or a day here or there during May - August but I tell people never to count on fog free days during that time.
Going over to Yosemite and then going north up the eastern side of the Sierra Nevadas on 395, through Lassen to the 97 and then choose the point you want to cross back over to the other side of the mountains to hit Vancouver - a much safer bet in terms of weather.