My question is very similar in spirit to this question: What is the best plotting library for Python?
What is my best bet for plotting data in C? Am I better off forgoing a library and just generating data that I can feed directly into gnuplot?
My impetus for this question is being able to visualize DSP transformations while studying the excellent resources found in an earlier question of mine. So the focus is really just 2D plots, histograms, etc.; 3D isn't as important right now.
Matplotlib Matplotlib is the most popular data visualization library of Python and is a 2D plotting library. It is the most widely-used library for plotting in the Python community and is more than a decade old.
C and Gnuplot can be used to plot complex functions. One can write the function in C and then write the values of the function at various values in a txt file, which can then be plotted using Gnuplot. The txt file should have numerical values in at least two columns. The first column is for x values.
matplotlib. matplotlib is the O.G. of Python data visualization libraries. Despite being over a decade old, it's still the most widely used library for plotting in the Python community.
Plotly is a library that brings the power of interactive plotting with JavaScript to languages like Python and R. It is built with JavaScript and takes advantage of the powerful D3. js library. Using Plotly, we can create interactive plots in Python with only a few lines of code.
I think you are on the right track with gnuplot. For what you want, it's very powerful and flexible.
However, you may want to consider writing to gnuplot directly from your application instead of creating data and feeding it. There is an ANSI C API to gnuplot available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With