It could be that the dog thinks the lion is a threat and is trying to scare it away with barking. Or perhaps the dog is just being territorial and wants the lion to leave the area of the tree.
It usually means the dog is making a mistake or pursuing something that won't lead to the result it wants in the cartoon.
Maybe it saw something that made it feel threatened or excited.
Maybe it saw something that made it excited or scared.
It could be barking to protect its territory or to get attention. Sometimes dogs bark just because they're excited or trying to communicate something.
Maybe the dog is excited about going on a trip or is trying to get the attention of its owner.
Maybe the dog is excited or scared by something in the car.
Maybe the dog is excited or sees something interesting and is trying to communicate that through barking while being on the leash.
The dog might bark at the mailman in the cartoon because it's instinctively wary of strangers. Or maybe the dog is excited and just expressing itself in a way that seems like barking at the mailman.
Maybe it's a plot device to create tension or add some kind of background noise.
A barking dog cartoon usually has a dog that looks fierce or excited when barking. The colors might be bold to draw attention. Sometimes, there could be thought bubbles to show what the dog is thinking or why it's barking.