Skip to content
Snippets Groups Projects
Commit 24c94298 authored by Michael Wimmer's avatar Michael Wimmer Committed by Christoph Groth
Browse files

fix colorbar if multiple symbols are used

parent a818f055
No related branches found
No related tags found
No related merge requests found
...@@ -1305,14 +1305,14 @@ def plot(sys, num_lead_cells=2, unit='nn', ...@@ -1305,14 +1305,14 @@ def plot(sys, num_lead_cells=2, unit='nn',
site_edgecolor) site_edgecolor)
lw = site_lw[slc] if isarray(site_lw) else site_lw lw = site_lw[slc] if isarray(site_lw) else site_lw
symbols(ax, sites_pos[slc], size=size, symbol_coll = symbols(ax, sites_pos[slc], size=size,
reflen=reflen, symbol=symbol, reflen=reflen, symbol=symbol,
facecolor=col, edgecolor=edgecol, facecolor=col, edgecolor=edgecol,
linewidth=lw, cmap=cmap, norm=norm, zorder=2) linewidth=lw, cmap=cmap, norm=norm, zorder=2)
end, start = end_pos[: n_sys_hops], start_pos[: n_sys_hops] end, start = end_pos[: n_sys_hops], start_pos[: n_sys_hops]
lines(ax, end, start, reflen, hop_color, linewidths=hop_lw, zorder=1, line_coll = lines(ax, end, start, reflen, hop_color, linewidths=hop_lw,
cmap=hop_cmap) zorder=1, cmap=hop_cmap)
# plot lead sites and hoppings # plot lead sites and hoppings
norm = matplotlib.colors.Normalize(-0.5, num_lead_cells - 0.5) norm = matplotlib.colors.Normalize(-0.5, num_lead_cells - 0.5)
...@@ -1351,10 +1351,11 @@ def plot(sys, num_lead_cells=2, unit='nn', ...@@ -1351,10 +1351,11 @@ def plot(sys, num_lead_cells=2, unit='nn',
m = (min_ + max_) / 2 m = (min_ + max_) / 2
ax.auto_scale_xyz(*[(i - w, i + w) for i in m], had_data=True) ax.auto_scale_xyz(*[(i - w, i + w) for i in m], had_data=True)
if ax.collections[0].get_array() is not None and colorbar: # add separate colorbars for symbols and hoppings if ncessary
fig.colorbar(ax.collections[0]) if symbol_coll.get_array() is not None and colorbar:
if ax.collections[1].get_array() is not None and colorbar: fig.colorbar(symbol_coll)
fig.colorbar(ax.collections[1]) if line_coll.get_array() is not None and colorbar:
fig.colorbar(line_coll)
if fig is not None: if fig is not None:
return output_fig(fig, file=file, show=show) return output_fig(fig, file=file, show=show)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment