See FAQ: What's a reproducible example (`reprex`) and how do I do one? for how to produce the specific code that creates your problem, please. That way other Ubuntu18.04 can see if the problem is reproducible. I've got a dual boot Win/Ubu, so if it fails on one it should fail on both since the same hardware is involved, and I've also got Mojave, with different hardware.
That way we may be able to decide if it might be a graphics device issue or a software issue. But without it only someone who has experienced the same problems as you describe has any chance of figuring out the right answer. Thanks,