Cats purr for a number of reasons and it doesn't always have to do with happiness. Many cats will purr when they feel content and relaxed, and this is why they will do it when they are being pet. However, Purring can also occur in stressful and painful situations.
Cats may purr when they are stressed, in pain, or anxious to soothe themselves. There are also studies which say that when purring the low frequency vibrations could help in healing tissues, reduce pain, and promote bone healing. You could also see cats purring during stressful situations such as when they are taken to the vet or don't feel good. It's a coping mechanism just as humans and other animals have their own coping mechanisms.
Purring can also be seen as a way of communicating. Kittens purr within 2 days of being born to tell their mother they are okay. Throughout adulthood, they will continue to use purring to communicate with humans when they need food or even attention.
Purring has been widely linked to happiness and affection but there are a lot of other behaviors that can be associated with it such as when they are not comfortable or seeking attention. Body language and the overall situation can help to understand why they are purring as it is not always having to do with happiness and affection.
Sources:
https://catsfanatic.com/behavior/understanding-cat-purrs/
https://www.petmd.com/cat/behavior/why-do-cats-purr
https://www.wired.com/2015/05/why-do-cats-purr/
on the uploaded document.Logging in, please wait... 
0 General Document comments
0 Sentence and Paragraph comments
0 Image and Video comments
General Document Comments 0