[PYTHON] Use a scripting language for a comfortable C ++ life 3-Leave graphing to matplotlib-

The part that makes me dissatisfied with developing programs in C ++ is the library for graphs. There are people around me who write graphs in Excel, I don't use Excel much in the following ways:

** Areas not suitable for Excel **

・ When the number of data exceeds 20,000 (Note 1) ・ When you want to write a histogram (Note 2) ・ When you want to clearly distinguish between data, processing, and drawing ・ When you want to use it cross-platform on Windows and Linux

** My current workaround **

-Use Matplotlib from python. Reason 1: I'm used to matplotlib from Python on a daily basis Reason 2: It is enough if the data is file-based and the python script is operated internally. Reason 3: I don't know a free library that works on windows and Linux and can be used for commercial development.

** Article How to easily create a graph using matplotlib from C ++ code **

If you use the method introduced in matplotlib-cpp From C ++ to C ++ as if it were your own plot library It seems that matplotlib can be used.

** Note: There is a way to use Gnuplot over the wrapper **

Gnuplot is a very helpful program. I have used it in an environment such as Windows / Linux / Cygwin. It was very useful because it has less OS dependency and can draw graphs. The features shown below were very helpful. Gnuplot is still used in various programs to create graphs. Since I started using Matplotlib under the python environment, I've been using gnuplot less often. Features of Gnuplot You can write graphs with a short script for file-based data entry. Works well with command line tools (pipes) such as awk. You can output a graph in a Postscript file. Functions can be fitted using the non-linear least squares method.

Advantages of Matplotlib You can create graphs at a level comparable to MATLAB graphics. You can create multiple subplots in one figure. Functions for displaying images etc. are prepared.

Note 1: Excel graph specifications and restrictions [Data elements that can be included in one data series of 2-D graph 32,000](https://support.office.com/ja-jp/article/Excel-%E3%81%AE % E4% BB% 95% E6% A7% 98% E3% 81% 8A% E3% 82% 88% E3% 81% B3% E5% 88% B6% E9% 99% 90-16c69c74-3d6a-4aaf-ba35 -e6eb276e8eaa)

Note 2: How to write frequency distribution table and histogram in Excel Histogram in Excel (frequency distribution map)

I wrote something like this before. I want to use matplotlib from C ++

** Reference information: What to do when using Japanese **

Some people have already written articles, so I will introduce them. Japanese with matplotlib Japanese settings for matplotlib and Seaborn axes Use Japanese for case law and graph titles in matplotlib

Recommended Posts

Use a scripting language for a comfortable C ++ life 3-Leave graphing to matplotlib-
Use a scripting language for a comfortable C ++ life
Use a scripting language for a comfortable C ++ life-OpenCV-Port Python to C ++-
Use a scripting language for a comfortable C ++ life 4-Use your own C ++ library from a scripting language-
Use a scripting language for a comfortable C ++ life 5 --Use the Spyder integrated environment to check numerical data-
Let's use a scripting language for a comfortable C ++ life C ++ implementation after verification with python
Let's use a scripting language for a comfortable C ++ life 6-How about developing a program as a library for Python?
Convenient to use matplotlib subplots in a for statement
Create a dataset of images to use for learning
Try to make a Python module in C language
[Introduction to python] A high-speed introduction to Python for busy C ++ programmers
How to use Matplotlib
[python] How to use the library Matplotlib for drawing graphs
A note for embedding the scripting language in a bash script
Note 2 for embedding the scripting language in a bash script
How to temporarily implement a progress bar in a scripting language
Try to select a language
[Comfortable development] Four things I practice to lead a comfortable programming life
[C language] [Linux] Try to create a simple Linux command * Just add! !!
Scripting Language C ——How a text file without a shebang is executed
[Introduction to Python] How to use the in operator in a for statement?
A story about trying to improve the testing process of a system written in C language for 20 years