When a defendant asserts an affirmative defense, the burden of proof shifts to the defendant from the plaintiff. Affirmative defenses can also be offered in criminal trials, but since you talk about the plaintiff and not the prosecution, I assume you are asking about civil cases and I will discuss that type of case here.
An affirmative defense is one that accepts all the charges that the plaintiff makes, but goes on to assert other facts that, if proven, would make the defendant not be liable (or be less liable) for the harm that has been done. In essence, the defense is saying “yes, I did what you say, but I am not liable because of the following facts.” For example, let us say that you are alleging that I crashed into your car because I was negligently texting as I drove. I could offer an affirmative defense of contributory negligence on your part. For example, I could allege that even though I was texting, you ran a stop sign and so you contributed to the accident.
In such a defense, the burden of proof shifts from you, the plaintiff, to me, the defendant.
the burden of proof may shift to the defendant if the defendant raises a factual issue in defense to the plaintiff's claims. (Cornell Law School about Nolo's Plain-English Law Dictionary)