drawing graph

A

adonis

hi to everybody.
how can i draw a 2d diagram in vc++?
i don't know anything about thath.
please help me.
thanks.
 
U

utab

hi to everybody.
how can i draw a 2d diagram in vc++?
i don't know anything about thath.
please help me.
thanks.

This is not possible through standard C++, however it is possible by
using API functions in windows or equivalents in linux. The easiest
way would be to call an open source plotter, such as gnuplot. You can
call gnuplot from within C++ with "system" function however forming
the data file and making the plot outside the program seems better to
me.
 
A

adonis

This is not possible through standard C++, however it is possible by
using API functions in windows or equivalents in linux. The easiest
way would be to call an open source plotter, such as gnuplot. You can
call gnuplot from within C++ with "system" function however forming
the data file and making the plot outside the program seems better to
me.

can i do that in MATLAB?
is it possible to import data in MATLAB?
how can i do that?
 
R

red floyd

adonis said:
can i do that in MATLAB?
is it possible to import data in MATLAB?
how can i do that?

Yes, yes, and ask in a forum where MATLAB is topical (try
comp.soft-sys.matlab).
 
U

utab

can i do that in MATLAB?
is it possible to import data in MATLAB?
how can i do that?

MATLAB and C++ are two different environments/languages, MATLAB is an
interpretted language for fast manipulation of array computations and
to do first tries for a numerical work. What is your specific task?

MATLAB has many built-in functions which you may use for many of your
tasks including plotting graphs, but what is your aim? Still it is not
that clear to me.

Rgds,
 
S

SeanW

hi to everybody.
how can i draw a 2d diagram in vc++?
i don't know anything about thath.
please help me.
thanks.

As others have said, you'll need some external library.
The ImageMagick++ library fits nicely with C++
and its standard library:

http://www.imagemagick.org/Magick++/

The following brief program takes coordinates from
the standard input and draws corresponding points
on a GIF image.

Sean



#include <iostream>
#include <Magick++.h>

using namespace std;
using namespace Magick;

int main()
{
int width = 300;
int height = 400;
Image image( Geometry(width, height), Color("white") );

image.strokeColor("red");

// take space-separated (x,y) coordinates
while (cin)
{
int x, y;
cin >> x >> y;
image.draw(DrawablePoint(x, height - y));
}

image.write("dots.gif");
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top