The above code did not work for me. I had to replace the following part:
fig = plt.figure()
ax = fig.add_axes([0, 0, 1, 1])
ctx = RenderContext(doc)
ctx.set_current_layout(msp)
ctx.current_layout.set_colors(bg='#FFFFFF')
out = MatplotlibBackend(ax)
Frontend(ctx, out).draw_layout(msp, finalize=True)
with the following:
fig = plt.figure()
ctx = RenderContext(doc)
# Better control over the LayoutProperties used by the drawing frontend
layout_properties = LayoutProperties.from_layout(msp)
layout_properties.set_colors(bg='#FFFFFF')
ax = fig.add_axes([0, 0, 1, 1])
out = MatplotlibBackend(ax, params={"lineweight_scaling": 0.1})
Frontend(ctx, out).draw_layout(msp,layout_properties=layout_properties, finalize=True)
Note: make sure to add this at the start:
from ezdxf.addons.drawing.properties import Properties, LayoutProperties