(Click on the map to embiggen).
I've highlighted the San Francisco market. Click here to see the full Trulia article where you can play with some of the assumptions included in their calculations. They also offer a full calculator where you can plug in numbers specific to your situation.
One of the main points of their article is to be sure to include the cost of monthly home owners association (HOA) dues. We've noticed a significant increase in dues over the past few years and they can make a significant impact on your rent vs. buy situation.