I would suggest you to go through the "pgfmanual.pdf" once. Search for it on google, download it and leaf through it and hopefully you will find your question answered.