def draw_map(triangulation, options): ''' get the triangle tuple (concentration, triangle] prepared before and draw the map of triangles options : "map_format": "svg", "map_file": "../../mapa" ''' lab_x = options['xlabel'] if value_set(options, 'xlabel') else 'mesh X coord' lab_y = options['ylabel'] if value_set(options, 'ylabel') else 'mesh Y coord' lab_tit = options['title'] if value_set(options, 'title') else 'Map of concentrations' plt.figure() plt.gca().set_aspect('equal') plt.tripcolor(triangulation['x_np'], triangulation['y_np'], triangulation['triangles'], facecolors=triangulation['zfaces'], edgecolors='k') plt.colorbar() plt.title(lab_tit) plt.xlabel(lab_x) plt.ylabel(lab_y) plt.savefig(options["map_file"], format=options["map_format"])
def __init__(self, triangulation, options, parent=None): super(MapCanvas, self).__init__(parent) self.triang = triangulation self.first_run = True self.lab_x = options['xlabel'] if value_set(options, 'xlabel') else 'mesh X coord' self.lab_y = options['ylabel'] if value_set(options, 'ylabel') else 'mesh Y coord' self.title = options['title'] if value_set(options, 'title') else 'Map of concentrations' self.setWindowTitle(self.title) self.create_main_frame() self.on_draw()
def draw_chart(data, settings): ''' draw png file ''' lab_x = settings['xlabel'] if value_set(settings, 'xlabel') else 'time (s)' lab_y = settings['ylabel'] if value_set(settings, 'ylabel') else 'concentration' lab_tit = settings['title'] if value_set(settings, 'title') else 'concentration' plt.clf() plt.plot(data['times'], data['disp'], '-', lw=2) plt.xlabel(u'{}'.format(lab_x)) plt.ylabel(u'{}'.format(lab_y)) plt.title(u'graph of {} for element {}'.format(lab_tit, settings['xkey'])) plt.grid(True) plt.axes() plt.savefig('{}element_{}'.format(settings['where'], settings['xkey'])) plt.close()