Well, every time he fought Law, he had some type of advantage.
When they fought on Green Bit, he had an Admiral aiding him.
When they fought on the bridge, Law had already been using his powers frequently beforehand, and Doffy was also trying to get under Law's skin (as Law himself admitted afterwards).
When they fought on the roof in Dressrosa, Doffy had Trebol, parasited Bellamy, and a black knight (or what ever the string clone is named) helping him out. Among other things, like Law using a massive room and what not.
I do believe Doffy would win in a clean 1v1, but it wouldn't be below a high diff, that's for sure.