physics-hacker / physicshacker.com

PhysicsHacker.com website
GNU General Public License v2.0
0 stars 0 forks source link

Plotting multiple quantities vs time #14

Open chrisorban opened 8 years ago

chrisorban commented 8 years ago

Thanks to Chris Britt we now have a way to plot a quantity vs time (see spring_graph). However, we need to plot multiple quantities at the same time for the forthcoming energy conservation exercise. Someone should take spring_graph and figure out how to do this.

chrisorban commented 8 years ago

Update: apparently you can plot multiple quantities with spring_graph. I'm working on a demo. Stay tuned.

ghost commented 8 years ago

The code I submitted should be able to plot multiple graphs. (The simplest way is to overlay several different graphs.) I can easily however add an intuitive functionality for this if you would like. Would you prefer me to submit a push with this feature now or add it to the kinetic energy lab when it is completed?

chrisorban commented 8 years ago

Hold on for right now. I've basically got it working.

chrisorban commented 8 years ago

I just did an update to spring_graph that plots two quantities. There is a weird bug where the axis starts off red until the ship collides with the blob. Let me know if you can fix that. I'd also like the default setSize and setPosition to be as indicated in spring_graph.pde. In other words when setSize and setPosition aren't given I'd like the values to default to the ones I specified in spring_graph.pde.

chrisorban commented 8 years ago

I tried to make setSize and setPosition default to particular values but I couldn't figure out how.

ghost commented 8 years ago

The methods setSize and setPosition are merely "setters" to provide an interface for the internal values of the graph. As all size and position of the graph are inherited from the class BaseGraph this is where the internal values are stored. The internal values for position are m_x and m_y, the internal values for size are m_size_x and m_size_y. If you change what these are set to in BaseGraph.pde, you will change the default values for position and size. I hope this is not confusing.

ghost commented 8 years ago

Submitted pull request, review at your leisure.