I have a problem and struggle to find a solution, or phrase the question for a search engine. I have many python plots where i use hatches to show exclusions from constraints (so some hatches are not in the plot). However in the legend these hatches look weird, because they are not centered but aligned to the global grid. For example "HS excl." is the hatch "++", but the horizontal line is not centered. Similar for "STU obs." or "Vacuum stab.". Is there a way to adjust the refence point for the legend, or any other way to fix that issue? My Legend code looks like this:
legend_elements=[Patch(facecolor='none',hatch="\\\\",label='not unitary',edgecolor="#8D8896",lw=1),
Patch(facecolor='none',hatch="//",label='not bfb',edgecolor="#752692",lw=1),
Patch(facecolor='none',hatch="---",label='STU obs.',edgecolor="#124C8A",lw=1),
Patch(facecolor='none',hatch="xx",label='Vacuum stab.',edgecolor="#B9314F",lw=1),
Patch(facecolor='none',hatch="||",label='HB excl.',edgecolor="#F57200",lw=1),
Patch(facecolor='none',hatch="++",label='HS excl.',edgecolor="tab:green",lw=1),
Patch(facecolor='none',hatch="//",label='$h_{95}$ excl.',edgecolor="#4EA5D9",lw=1),
Patch(facecolor="darkgreen",label='stable')
]
ax.legend(handles=legend_elements,ncols=2,loc="lower center",bbox_to_anchor=(0.5, 1.05))
Thank you very much.
hatch="++++"
in the legend, while usinghatch="++"
in the plot.