Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
summer_2018:vpython_tips [2021/06/24 15:20]
bott123 [Common Commands]
summer_2018:vpython_tips [2021/06/24 16:03] (current)
pwirving
Line 63: Line 63:
 print(CD) ​ #This will print out the vector (-8, 9, -8) print(CD) ​ #This will print out the vector (-8, 9, -8)
 </​code>​ </​code>​
-  ​* **Graphing** - There are a few ways to graph in python, but a common method is via gcurve. If the values you wish to plot are changing over time in a loop, be sure to put the plot command in the loop with them, and plot each point for each iteration of the loop. + 
-<​code>​ + 
-ExampleGraph = gcurve(color=color.green,​ label = 'Data Points'​) ​ #First, define the graph.  +  ​* **Graphing** - One method of graphing involves using physutil, which is a library that needs to be imported. From there, the syntax is similar to gcurve. MUST use GlowScript 2.9 or lower; anything higher will not import properly.
-ExampleGraph.plot([1,​2],​[3,​4],​[5,​6]) ​ #This will plot the three points listed, connected by a line. +
-</​code>​ +
-Another ​method of graphing involves using physutil, which is a library that needs to be imported. From there, the syntax is similar to gcurve. MUST use GlowScript 2.9 or lower; anything higher will not import properly.+
 <​code>​ <​code>​
 get_library('​https://​cdn.rawgit.com/​PERLMSU/​physutil/​master/​js/​physutil.js'​) ​ #Imports physutil get_library('​https://​cdn.rawgit.com/​PERLMSU/​physutil/​master/​js/​physutil.js'​) ​ #Imports physutil
  • summer_2018/vpython_tips.1624548052.txt.gz
  • Last modified: 2021/06/24 15:20
  • by bott123