drawing graph

Discussion in 'C++' started by adonis, Apr 18, 2008.

  1. adonis

    adonis Guest

    hi to everybody.
    how can i draw a 2d diagram in vc++?
    i don't know anything about thath.
    please help me.
    thanks.
    adonis, Apr 18, 2008
    #1
    1. Advertising

  2. adonis

    utab Guest

    On Apr 18, 9:05 am, adonis <> wrote:
    > 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.
    utab, Apr 18, 2008
    #2
    1. Advertising

  3. adonis

    adonis Guest

    On Apr 18, 3:52 pm, utab <> wrote:
    > On Apr 18, 9:05 am, adonis <> wrote:
    >
    > > 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.


    can i do that in MATLAB?
    is it possible to import data in MATLAB?
    how can i do that?
    adonis, Apr 18, 2008
    #3
  4. adonis

    red floyd Guest

    adonis wrote:
    > On Apr 18, 3:52 pm, utab <> wrote:
    >> On Apr 18, 9:05 am, adonis <> wrote:
    >>
    >>> 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.

    >
    > 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).
    red floyd, Apr 18, 2008
    #4
  5. adonis

    utab Guest

    On Apr 18, 8:52 pm, adonis <> wrote:
    > On Apr 18, 3:52 pm, utab <> wrote:
    >
    > > On Apr 18, 9:05 am, adonis <> wrote:

    >
    > > > 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.

    >
    > 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,
    utab, Apr 18, 2008
    #5
  6. adonis

    SeanW Guest

    On Apr 18, 3:05 am, adonis <> wrote:
    > 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");
    }
    SeanW, Apr 18, 2008
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    633
    Kevin Spencer
    Jan 9, 2006
  2. Newbie

    drawing a graph

    Newbie, May 14, 2005, in forum: Java
    Replies:
    8
    Views:
    579
    Amit Chatterjee
    May 18, 2005
  3. matt

    Drawing Graph In VC++

    matt, Feb 11, 2004, in forum: C++
    Replies:
    2
    Views:
    7,138
    Howard
    Feb 11, 2004
  4. defn noob
    Replies:
    1
    Views:
    384
    Mark Space
    Jun 28, 2008
  5. Emilio Mayorga
    Replies:
    6
    Views:
    331
    Martien Verbruggen
    Oct 8, 2003
Loading...

Share This Page