Greetings!
Having a decent amount of experience in Fortran and Python, i decided to give a shot at C++. What i am trying to do at the moment is to plot a 2-dimensional diagram from 2 1-dimensional arrays of the same size. From what i understand, there is no direct way to do this. I'd really like your help on this one.
Thank you in advance.
OS: Debian Wheezy 7.6
Compiler: g++ 4.7.2-5
edit: After searching a bit more, i'm beginning to think that the easiest way is to save data in a text format and then use some external tool like gnuplot.
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
C++:How to plot a 2-d graph of 2 1-d arrays.
Re: C++:How to plot a 2-d graph of 2 1-d arrays.
First, You're most likely using Debian Wheezy 7.9 - unless You have decided to not update Your OStsathoguah wrote:i decided to give a shot at C++. What i am trying to do at the moment is to plot a 2-dimensional diagram from 2 1-dimensional arrays of the same size. From what i understand, there is no direct way to do this. I'd really like your help on this one.
Thank you in advance.
OS: Debian Wheezy 7.6
Compiler: g++ 4.7.2-5
edit: After searching a bit more, i'm beginning to think that the easiest way is to save data in a text format and then use some external tool like gnuplot.
Second: Any graphical representation of data needs a framework/an environment which is able to display things on the screen - that is, a GUI of some sort.
There are plenty of possibilities available for C++ programs - starting from plain X-windows interface, ending up with more user-friendly ones, like GTK, QT or wxWidgets - pick one, learn it.
Each of the aforementioned environments offers a way to display charts, bargraphs etc... - and in all cases You should be able to find a dedicated library for generating function plots of any kind...
Regards.
Odi profanum vulgus
Re: C++:How to plot a 2-d graph of 2 1-d arrays.
How about a:
struct Point { int x, y; }; // A 2-D array.
Point arr[5] = { { 1, 1 }, { 2, 2 }, { 3, 3 }, {4, 4}, {5 , 5} }; // 2-D array initialized
void f(Point *ptr) { ... } // print an '*' for a given ptr.
int main() {
f(arr);
return 0;
}
struct Point { int x, y; }; // A 2-D array.
Point arr[5] = { { 1, 1 }, { 2, 2 }, { 3, 3 }, {4, 4}, {5 , 5} }; // 2-D array initialized
void f(Point *ptr) { ... } // print an '*' for a given ptr.
int main() {
f(arr);
return 0;
}
tsathoguah wrote:Greetings!
Having a decent amount of experience in Fortran and Python, i decided to give a shot at C++. What i am trying to do at the moment is to plot a 2-dimensional diagram from 2 1-dimensional arrays of the same size. From what i understand, there is no direct way to do this. I'd really like your help on this one.
Thank you in advance.
OS: Debian Wheezy 7.6
Compiler: g++ 4.7.2-5
edit: After searching a bit more, i'm beginning to think that the easiest way is to save data in a text format and then use some external tool like gnuplot.
-
- Posts: 31
- Joined: 2014-09-07 10:10
Re: C++:How to plot a 2-d graph of 2 1-d arrays.
I thank both of you and will certainly try your suggestions. On a side note, gnuplot as an independent tool looks interesting with a relatively simple syntax.