0

By default, Matplotlib "clips" or "truncates" circles (or other symbols) displayed as hatch overlay, as illustrated in the example figure created with this code.

import numpy as np
from matplotlib import pyplot as plt
n = 20
sig = np.ma.masked_greater(np.random.rand(n,n), 0.25)
f, ax1 = plt.subplots(1,1, figsize=(4,4))
ax1.pcolor(sig, hatch="o", alpha=0)

matplotlib hatching example with truncated circles

I understand why this is so, but in some of my applications, I would like to solely display "untruncated" symbols. In the below example, I tried ax1.pcolor(sig, hatch="o", alpha=0, clip_on=False), but it has no effect.

How is this possible? And: I there any option to control that "truncated" symbols are either (a) not shown at all or (b) as complete symbols?

Mr. T
  • 11,960
  • 10
  • 32
  • 54
angilaka
  • 41
  • 1
  • 1
  • Is this affected by the original value? Draw a graph with this code.`sig = np.ma.masked_greater(np.random.rand(n,n), 1.0)` – r-beginners Jan 12 '21 at 12:26
  • Yes, but there are still clipped circle markers at the subplot's border. I'm looking for ways to avoid any display of truncated markers. By default, they are clipped at the data boundaries – but how to e.g. "completely" display markers that partially cross the boundary? – angilaka Jan 12 '21 at 17:35
  • If you want to prevent it from being cut off at the boundary, you may have to draw it in less than the boundary – r-beginners Jan 13 '21 at 01:56
  • Could you maybe provide a hint how to do that with the example? In QGIS, you can put "show partial labels" on/off, I was looking for something comparable in matplotlib for symbols/markers displayed with the hatch option. Thanks. – angilaka Jan 13 '21 at 07:51

0 Answers0