Enable edge parameter in plotImage.#371
Enable edge parameter in plotImage.#371huangchieh wants to merge 1 commit intoProbe-Particle:mainfrom
edge parameter in plotImage.#371Conversation
plotImage.
plotImage.edge parameter in plotImage.
|
Is this how you want it without the edges at all? We could also just adjust the width of the edge line to be thinner. Or arguably the size of the image should be larger with such a large unit cell, so we could automatically adjust the resolution based on the unit cell size, which would also make the edge lines adjust at the same time. |
|
The main motivation is simply to distinguish different atoms by color. When the simulation cell becomes large, it would be nice to have the option to disable edge drawing entirely to avoid the appearance of black dots. I tried passing the lw parameter to def plotAtoms(atoms, atomSize=default_atom_size, edge=True, ec="k", color="w", lw=1.0):
plt.fig = plt.gcf()
atoms[0]
xs = atoms[1]
ys = atoms[2]
if len(atoms) > 4:
colors = atoms[4]
else:
colors = [color] * 100
for i in range(len(atoms[1])):
fc = "#%02x%02x%02x" % colors[i]
if not edge:
ec = fc
circle = plt.Circle((xs[i], ys[i]), atomSize, fc=fc, ec=ec, lw=lw)
plt.fig.gca().add_artist(circle)Since the atom size in the image is quite small, using a thinner line width still makes it difficult to distinguish the colors. In this case, setting the edge color to match the fill color actually gives a cleaner visual result than reducing the line width. Ideally, the edge width could be adjusted automatically based on the cell size. To achieve this, we might need to pass the cell information to |
I forget how matplotlib treats this, but it might be enough to just scale up the |

Fix #370 Now, the parameter
edgeis enabled. In some cases, when the scanning range is large, one can useedge=Falseto disable edge drawing. Then the correct color for the atoms reveal.