0

Example code:

fig, ax = plt.subplots()


ax.vlines(x=0.2, ymin=0.2, ymax=0.8, linewidth=10)
ax.vlines(x=0.6, ymin=0.2, ymax=0.8, linewidth=10)
ax.hlines(y=0.2, xmin=0.2, xmax=0.6, linewidth=10)
ax.hlines(y=0.8, xmin=0.2, xmax=0.6, linewidth=10)

Which outputs:

enter image description here

In the corners are gaps though, whereas I would like these to be flush.

To be clear - the corners currently look like :

enter image description here

And I would like to have them look like:

enter image description here

baxx
  • 3,956
  • 6
  • 37
  • 75

1 Answers1

1

Instead of drawing lines, why not draw a rectangle directly?

import matplotlib.patches as pt 
fig, ax = plt.subplots() 
frame = pt.Rectangle((0.2,0.2),0.4,0.6, lw=10,facecolor='none', edgecolor='k') 
ax.add_patch(frame)

Gives:

enter image description here

Mohammad
  • 3,276
  • 2
  • 19
  • 35