Beispiel #1
0
func plot_plane_axis(loc float64, dir int, preservePrev bool) {
	if !preservePrev {
		plt.PyCmds("gcf().add_subplot(111, projection='3d')\n")
	}
	sdir := []string{"x", "y", "z"}
	plt.PyCmds(io.Sf(`
from matplotlib.collections import PolyCollection
xs = [0.0, 1.0, 1.0, 0.0]
ys = [0.0, 0.0, 1.0, 1.0]
verts = [zip(xs, ys)]
poly = PolyCollection(verts)
gca().add_collection3d(poly, zs=%g, zdir='%s')
`, loc, sdir[dir]))
	return
}
Beispiel #2
0
func draw_truss(dat *FemData, key string, A *goga.Solution, lef, bot, wid, hei float64) (weight, deflection float64) {
	gap := 0.1
	plt.PyCmds(io.Sf(`
from pylab import axes, setp, sca
ax_current = gca()
ax_new = axes([%g, %g, %g, %g], axisbg='#dcdcdc')
setp(ax_new, xticks=[0,720], yticks=[0,360])
axis('equal')
axis('off')
`, lef, bot, wid, hei))
	_, _, weight, deflection, _, _, _ = dat.RunFEM(A.Int, A.Flt, 1, false)
	plt.PyCmds("sca(ax_current)\n")
	plt.PlotOne(weight, deflection, "'g*', zorder=1000, clip_on=0")
	plt.Text(weight, deflection+gap, key, "")
	return
}