<-- Home

S%c3%a1ch B%c3%a0i T%e1%ba%adp Gi%c3%a1o Tr%c3%acnh Seoul 4a

This interface allows gnuplot to be controlled from C++ and is designed to be the lowest hanging fruit. In other words, if you know how gnuplot works it should only take 30 seconds to learn this library. Basically it is just an iostream pipe to gnuplot with some extra functions for pushing data arrays and getting mouse clicks. Data sources include STL containers (eg. vector), Blitz++, and armadillo. You can use nested data types like std::vector<std::vector<std::pair<double, double>>> (as well as even more exotic types). Support for custom data types is possible.

This is a low level interface, and usage involves manually sending commands to gnuplot using the "<<" operator (so you need to know gnuplot syntax). This is in my opinion the easiest way to do it if you are already comfortable with using gnuplot. If you would like a more high level interface check out the gnuplot-cpp library (http://code.google.com/p/gnuplot-cpp).

Download

To retrieve the source code from git:
git clone https://github.com/dstahlke/gnuplot-iostream.git

Documentation

Documentation is available [here] but also you can look at the example programs (starting with "example-misc.cc").

Example 1

S%c3%a1ch B%c3%a0i T%e1%ba%adp Gi%c3%a1o Tr%c3%acnh Seoul 4a

Chào mừng các bạn đến với cộng đồng học tiếng Hàn! Ngày hôm nay, chúng tôi sẽ giới thiệu đến các bạn một trong những tài liệu học tập quan trọng và được nhiều học viên yêu thích: .

Sách Bài Tập Giáo Trình Seoul 4A là một phần không thể thiếu trong chương trình học tiếng Hàn của nhiều học viên. Đây là cuốn sách được biên soạn nhằm giúp học viên nâng cao trình độ tiếng Hàn của mình, đặc biệt là trong lĩnh vực giao tiếp. s%C3%A1ch b%C3%A0i t%E1%BA%ADp gi%C3%A1o tr%C3%ACnh seoul 4a

Cuốn sách này thuộc bộ giáo trình Seoul, một trong những bộ giáo trình tiếng Hàn thông dụng và hiệu quả nhất hiện nay. Với nội dung phong phú, đa dạng và cách trình bày rõ ràng, Sách Bài Tập Giáo Trình Seoul 4A đã trở thành một người bạn đồng hành đáng tin cậy của nhiều học viên trên con đường học tiếng Hàn. Chào mừng các bạn đến với cộng đồng

Sách Bài Tập Giáo Trình Seoul 4A là một tài liệu học tập quan trọng và hiệu quả cho những ai muốn nâng cao trình độ tiếng Hàn của mình. Hy vọng rằng, thông qua bài viết này, các bạn sẽ có thể tìm hiểu thêm về cuốn sách và cách sử dụng nó để đạt được kết quả học tập tốt nhất. Chúc các bạn thành công trên con đường học tiếng Hàn! Đây là cuốn sách được biên soạn nhằm

Sách Bài Tập Giáo Trình Seoul 4A - Hướng Dẫn Học Tập Hiệu Quả

Example 2

// Demo of sending data via temporary files.  The default is to send data to gnuplot directly
// through stdin.
//
// Compile it with:
//   g++ -o example-tmpfile example-tmpfile.cc -lboost_iostreams -lboost_system -lboost_filesystem

#include <map>
#include <vector>
#include <cmath>

#include "gnuplot-iostream.h"

int main() {
	Gnuplot gp;

	std::vector<std::pair<double, double> > xy_pts_A;
	for(double x=-2; x<2; x+=0.01) {
		double y = x*x*x;
		xy_pts_A.push_back(std::make_pair(x, y));
	}

	std::vector<std::pair<double, double> > xy_pts_B;
	for(double alpha=0; alpha<1; alpha+=1.0/24.0) {
		double theta = alpha*2.0*3.14159;
		xy_pts_B.push_back(std::make_pair(cos(theta), sin(theta)));
	}

	gp << "set xrange [-2:2]\nset yrange [-2:2]\n";
	// Data will be sent via a temporary file.  These are erased when you call
	// gp.clearTmpfiles() or when gp goes out of scope.  If you pass a filename
	// (e.g. "gp.file1d(pts, 'mydata.dat')"), then the named file will be created
	// and won't be deleted (this is useful when creating a script).
	gp << "plot" << gp.file1d(xy_pts_A) << "with lines title 'cubic',"
		<< gp.file1d(xy_pts_B) << "with points title 'circle'" << std::endl;

#ifdef _WIN32
	// For Windows, prompt for a keystroke before the Gnuplot object goes out of scope so that
	// the gnuplot window doesn't get closed.
	std::cout << "Press enter to exit." << std::endl;
	std::cin.get();
#endif
}

<-- Home