Plotting library

For work, I have been needing to do lots of plots and graphs. To comply with the LGPL license, I’m disclosing it here. I have made one slight modification to PointPairList in that I added a function that returns the average of the X, Y or Z points in the graph.

The new functionality I have is a class object that implements the functionality of the ‘figure’ command from Matlab. It makes it so that you can have an array of doubles and just call a method to have a window pop up with the plot of the data.

plot

Additionally it might be desirable to have a Bode Plot generated from a series of Complex numbers corresponding to certain frequencies. This can be done with the BodePlot class object.

bode

Finally, I also have a ‘mesh’ function implemented. The mesh is drawn correctly, but there are some small issues with the movement of the graph. Click and dragging the left mouse button clumsily does a rotate in the X-Y plane. If the Ctrl key is held, then a translation is performed in the X-Y plane. If the right mouse button is clicked and dragged, then a rotation on the Z axis is done.

mesh

The scroll wheel causes a zooming effect. Holding the right then clicking the left mouse button causes the mesh to be filled.

mesh_fill

In addition, each of these classes keeps track of how many instances there are, and one can call a ‘closeall’ function to close all the plots that remain open.

The Graph Library with example graphs can be downloaded here I used Visual Studio 2008, but a project can easily be created in VS2005 using the C# files in the zip file.

Credits:
ZedGraph, 3D Mesh

As always I hope this helps someone. If you find any bugs, kindly let me know, or better yet, send me a bugfix. I’ll gladly give credit, and update these files.
Fekete András

Liked it? Take a second to support me on Patreon!

Leave a Reply