Introduction
Plotting on x-y axes is one of the most useful ways you can show data and trends, whether you are an academic researcher or an industry professional. This is relatively easy to do with programming tools like Matlab where the plotting functionality is built right in. Programming languages like Python utilize Matlab tools in the commonly used matplotlib library, which allows easy generation and embedding of plots.
Unfortunately, it is not so easy in C++. There's no plotting library in C++ which is as widely used as matplotlib in Python. However, it is still possible to generate plots using C++ - your task in this extra credit assignment is to tell us how.
Description
In this assignment you will:
1.Find a way to generate a plot with a C++ script. The plot must be generated from the compilation/execution of the C++ code alone. I have provided some sample wavelength/power data from a green LED here ( . csv) and here (tab-delimitted . txt) that you may plot.
2. Write a script that successfully uses this plotting tool to plot. If you plot different data than what I have linked above provide this source data in your submission.
Write instructions for how to use this plotting tool. These instructions must be detailed keep track of what issues you run into when attempting to use the tool so that you can address them in the write-up. We will be following your instructions in the write-up and attempt to plot using you method, so make sure it's detailedi This is how the teaching team will determine how manv points to award. Write every step you needed to do in order to use the tool.
· Ex: If you just need to include a header file or library at the top or your script to plot, how do you link these libraries? If you try to port matplotlib to C++ using matplotlibcpp . h (see below), there are issues finding the <Python.h> and
<numpy /arrayobject h>. If you have Python with numpy installed, you likely already have these headers. In the write-up, you would need to address how you linked these to compile and run your script using matplotlibc pp . h (update include path, include directories during compilation).
· After updating your include path (to remove errors in VS Code), you will need to include this directory while compiling your file. A usefule guide for updating your make file is located here.
Submit your code ( . cpp file), source for plot data (if using different data), resulting plot, any additional headers/files that you need to #include and write-up to me by the deadline. If you added anything to your #include paths to run your code, send me your include paths and updated make f ital I will need all five of these to verify your work!
Again, I will be following your instructions in the write-up and attempt to plot using you method, so make sure it's as detailed as possible. I will determine points as follows:
* +5% to your final grade: Submitted all required documents. Write-up and submissions were sufficient for me/TAs to follow and plot using your chosen method (ie: can an experienced coder follow your instructions and plot using them alone?)
* +2o/o to your final grade: Submitted all required documents. Write-up was notsufficient or was missing key information that a user needs in order to plot using your chosen method.
No credit for an incomplete assignment. If I see you have just copy-pasted Places to start You may use any plotting method you wish as long as it is available from within a C++ script. However, if you are struggling, here are some places you can start from:
* MatPlotLib for C++: As mentioned above, you can port ma t plo t 1 ib to C++ with a header "matplotlibcpp. h" . A link to instructions and the source files for this are located here on GitHub. If you are used to plotting in Python, this may be a good place to start.
* gnuplo t fof C++: A useful writeup for this is located here. In addition to saning up your #include paths for the header file, you will also need the Boos t library (available here - if you have a Mac and Homebrew, you can also just run brew instalL boost interminal).
·QCustomPlot: QCus t omP to t is a Qt C++ widget for plotting and data visualization. It has no further dependencies and is well documented. This requires the Qt library, which you may be able to get a free license for. Due to the license requirement, I recommend you try the above two methods or another method first.
By the deadline, submit the following:
Your . cpp file
Your inc Lude path and any additional files you need to include locally to run your file (ie: a header like ma t plo tl ibcpp . h)
Images that result from your code - your command line, resulting plot, etc. Also include the source data for the plot (if using data different than the green LED data I provided above).
Your detailed write-up. Remember, this write-up should be something you can give to a classmate that they can follow with no additional instructions in order to achieve the same plotted results