def conductor_collection(self):
# TODO: Once dielectrics register with solver add in loop to append them to dielectric array
if not self.plot_axes:
self.create_axes()
if len(self.voltages) > 0:
self.set_collection_colors(self.conductor_patch_colors, self.voltages, self.map)
# Assign patches for conductors to the plot axes
self.conductor_patches = PatchCollection(self.conductors)
self.conductor_patches.set_color(self.conductor_patch_colors)
self.plot_axes.add_collection(self.conductor_patches)
if len(self.permittivities) > 0:
self.set_collection_colors(self.dielectric_patch_colors, self.permittivities, plt.cm.viridis)
# Assign patches for dielectrics to the plot axes
self.dielectric_patches = PatchCollection(self.dielectrics)
self.dielectric_patches.set_color(self.dielectric_patch_colors)
self.dielectric_patches.set_hatch('//')
self.plot_axes.add_collection(self.dielectric_patches)
# Setup the legend and set data for legend axes
self.create_legend()
if len(self.voltages) > 0:
cond_legend = self.legend_axes.legend(handles=self.conductor_legend_handles,
bbox_to_anchor=self.legend_anchor,
borderaxespad=0.,
fontsize=self.legend_fontsize,
title='Voltage (V)')
self.legend_axes.add_artist(cond_legend)
if len(self.permittivities) > 0:
diel_legend = self.legend_axes.legend(handles=self.dielectric_legend_handles,
bbox_to_anchor=(self.legend_anchor[0] + 0.05, self.legend_anchor[1] - 0.2),
borderaxespad=0.,
fontsize=self.legend_fontsize,
title=' Relative\nPermittivity')
self.legend_axes.add_artist(diel_legend)
评论列表
文章目录