← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2815: added nice legend to the plots

 

------------------------------------------------------------
revno: 2815
committer: Janek Kozicki <cosurgi@xxxxxxxxxx>
branch nick: yade
timestamp: Fri 2011-04-15 21:02:50 +0200
message:
  added nice legend to the plots
modified:
  examples/simple-scene/simple-scene-energy-tracking.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'examples/simple-scene/simple-scene-energy-tracking.py'
--- examples/simple-scene/simple-scene-energy-tracking.py	2011-04-15 18:15:03 +0000
+++ examples/simple-scene/simple-scene-energy-tracking.py	2011-04-15 19:02:50 +0000
@@ -63,9 +63,24 @@
 ## we will have 2 plots:
 ## 1. t as function of i (joke test function)
 ## 2. i as function of t on left y-axis ('|||' makes the separation) and z_sph, v_sph (as green circles connected with line) and z_sph_half again as function of t
-plot.plots={'t':('normal_Work','shear_Work','E_kin_translation','E_kin_rotation',
-	#'E_kin_r','E_kin_tr','E_pot_',  ## those are from energy tracker
-	'E_pot','total','total_plus_damp')}
+
+plot.labels={'t':'time [s]', 
+	'normal_Work':'Normal work: W=kx^2/2', 
+	'shear_Work':'Shear work: W=kx^2/2',
+	'E_kin_translation':'Translation energy: E_kin=m*V^2/2',
+	'E_kin_rotation':'Rotation energy: E_kin=I*$\omega$^2/2',
+	'E_pot':'Gravitational potential: E_pot=m*g*h',
+	'total':'total',
+	'total_plus_damp':'total + daping'}
+
+plot.plots={'t':('normal_Work',
+		'shear_Work',
+		'E_kin_translation',
+		'E_kin_rotation',
+		#'E_kin_r','E_kin_tr','E_pot_',  ## those are from energy tracker
+		'E_pot',
+		'total',
+		'total_plus_damp')}
 
 ## this function is called by plotDataCollector
 ## it should add data with the labels that we will plot
@@ -98,6 +113,7 @@
 		#E_kin_r	  = O.energy.items()[1][1],
 		#E_kin_tr	  = O.energy.items()[2][1],
 	)
+
 print "Now calling plot.plot() to show the figures. The timestep is artificially low so that you can watch graphs being updated live."
 plot.liveInterval=2
 plot.plot(subPlots=True)