How can I obtain something similar to a mosaic plot but representing just the information from a frequency table for a single variable?

mosaicplot(table(my\_var)) works fine, but only shows vertical bars.

Is it possible to obtain a mosaic plot like a puzzle of different tiles instead of just vertical bars? Something similar to this image:[![enter image description here](https://i.stack.imgur.com/8NV9b.png)](https://i.stack.imgur.com/8NV9b.png)