473,785 Members | 2,553 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Plotting the Results

Hi guys,

I have a quick question,

I have a program that generates numerical output (as most of the
programs), the program is written in C language, and currently I use
the "DOS interface to show the output when it is being generated.

is there a "short" and "non-complicated" code which plots the data
automatically instead of showing the numbers.

the plots don't have to be something very fancy...but instead of
on-line monitoring of the numbers, the output can plot them in "real
time" (as they are being generated)..

I am also trying to stay away from Visual C++ codes...just sticking to
C as much as possible...

I appreaciate your help

Thanks
Freddy

Nov 14 '05 #1
8 1712
Freddy <zf********@gma il.com> wrote:
I have a program that generates numerical output (as most of the
programs), the program is written in C language, and currently I use
the "DOS interface to show the output when it is being generated. is there a "short" and "non-complicated" code which plots the data
automatically instead of showing the numbers.
You won't get much help from standard C. If it's scientific
data, then IMHO it's best to keep output in files and
use another application to do the graphics.
the plots don't have to be something very fancy...but instead of
on-line monitoring of the numbers, the output can plot them in "real
time" (as they are being generated).. I am also trying to stay away from Visual C++ codes...just sticking to
C as much as possible...


You have to look for a library (Sourceforge?) or program it yourself.
Or call an external program via system() function (it depends, of course,
on the program if you can display the plots real-time); or maybe
you could "cooperate" somehow with an external program. All this
is outside the interests of this group; try comp.programmin g.

One portable method that comes to my mind is to make ascii graphics
(like GNUplot does in dumb terminal mode) and allow them to
scroll up. Depends on what fanciness level you want to have.

--
Stan Tobias
mailx `echo si***@FamOuS.Be dBuG.pAlS.INVALID | sed s/[[:upper:]]//g`
Nov 14 '05 #2
Freddy wrote:

I have a program that generates numerical output (as most of the
programs), the program is written in C language, and currently I use
the "DOS interface to show the output when it is being generated.

is there a "short" and "non-complicated" code which plots the data
automatically instead of showing the numbers.

the plots don't have to be something very fancy...but instead of
on-line monitoring of the numbers, the output can plot them in "real
time" (as they are being generated)..

I am also trying to stay away from Visual C++ codes...just sticking
to C as much as possible...


This may give you some ideas.

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

double pi;

/* ------------------- */

void pause(void)
{
/* fool around with the timers here if needed */
} /* pause */

/* ------------------- */

void plot(int angle)
{
double sine;
int isin;

sine = sin(pi * angle / 180);
isin = 30 * sine + 35.5;

printf("%4d %*c\n", angle, isin, '*');
} /* plot */

/* ------------------- */

int main(int argc, char *argv[])
{
int angle;

pi = 4 * atan(1.0);
for (angle = 0; angle < 3600; angle += 10) {
plot(angle);
pause();
}
return 0;
} /* main */

--
"If you want to post a followup via groups.google.c om, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #3
how can I create the ascii graphics...thes e graphics should be more
than enough...

any help?

Freddy

Nov 14 '05 #4
Freddy <zf********@gma il.com> wrote:
how can I create the ascii graphics...thes e graphics should be more
than enough...


Probably yourself. Or use Gnuplot to do it for you.

In Gnuplot it looks like this:
gnuplot> set term dumb
Terminal type set to 'dumb'
Options are 'feed 79 24'
gnuplot> plot sin(x)
1 ++----------------**---------------+----**-----------+--------**-----++
+ *+ * + * * + sin(x) ****** +
0.8 ++ * * * * * * ++
| * * * * * * |
0.6 ++ * * * * * * ++
* * * * * * * |
0.4 +* * * * * * * ++
|* * * * * * * |
0.2 +* * * * * * * ++
| * * * * * * * |
0 ++* * * * * * *++
| * * * * * * *|
-0.2 ++ * * * * * * *+
| * * * * * * *|
-0.4 ++ * * * * * * *+
| * * * * * * *
-0.6 ++ * * * * * * ++
| * * * * * * |
-0.8 ++ * * * * * * ++
+ * * + * * + * * +
-1 ++-----**---------+----------**----+---------------**+---------------++
-10 -5 0 5 10

gnuplot>
--
Stan Tobias
mailx `echo si***@FamOuS.Be dBuG.pAlS.INVALID | sed s/[[:upper:]]//g`
Nov 14 '05 #5

"Freddy" <zf********@gma il.com> wrote

is there a "short" and "non-complicated" code which plots the data
automatically instead of showing the numbers.

the plots don't have to be something very fancy...but instead of
on-line monitoring of the numbers, the output can plot them in "real
time" (as they are being generated)..

I am also trying to stay away from Visual C++ codes...just sticking to
C as much as possible...

No. There is no simple way of generating graphical data beyond ASCII art.

The easiest and most portable way is to output the file in an image format.
Unfortunately the two most useful formats, GIF and JPEG, are by no means
simple.
The other route is to use a platform-specific library for interactive
graphcs. It is normally not too difficult to get a window up on screen and
write a few strings of text and a scatter diagram or line graph to it.
However normally the code has to be set up in a special way which has big
implications for your program. It might be necessary to structure the flow
control around function pointers that are called when the mouse and keyboard
is pressed, for example.

Nov 14 '05 #6
> The easiest and most portable way is to
output the file in an image format.
Unfortunately the two most useful formats, GIF
and JPEG, are by no means simple.


The TGA format is very simple: a small header and 24 bits RGB for each
pixel. Recognized by drawing tools.

Nov 14 '05 #7

You can try an external plotting program, like gnuplot. You can even
use gnuplot within a C program if you can use pipes (not under DOS
I think). If you must use DOS, you can easily program a small plotting
library in VGA or VESA mode. If you use TC, a VGA library is
integrated, but only in 16 colors. If you need 256 colors, VGA mode 13h
is very easy (but low res: 320x200). VESA modes are relatively easy to use,
and allow 24 bits RGB. IMO, you should really consider gnuplot
(gnuplot.sf.net ).
Le 12/06/2005 16:16, dans
11************* *********@g14g2 00...legr oups.com, «*Freddy*»
<zf********@gma il.com> a écrit*:
Hi guys,

I have a quick question,

I have a program that generates numerical output (as most of the
programs), the program is written in C language, and currently I use
the "DOS interface to show the output when it is being generated.

is there a "short" and "non-complicated" code which plots the data
automatically instead of showing the numbers.

the plots don't have to be something very fancy...but instead of
on-line monitoring of the numbers, the output can plot them in "real
time" (as they are being generated)..

I am also trying to stay away from Visual C++ codes...just sticking to
C as much as possible...

I appreaciate your help

Thanks
Freddy


Nov 14 '05 #8
And I forgot, you can write your plot in a file.
There are fairly easy file formats: BMP, TGA, PSD, SGI(RGB), and TIFF.
They all have a small header and (almost) raw image data.
If you need documentation, www.wotsit.org is the first place to look.
Le 12/06/2005 16:16, dans
11************* *********@g14g2 00...legr oups.com, «*Freddy*»
<zf********@gma il.com> a écrit*:
Hi guys,

I have a quick question,

I have a program that generates numerical output (as most of the
programs), the program is written in C language, and currently I use
the "DOS interface to show the output when it is being generated.

is there a "short" and "non-complicated" code which plots the data
automatically instead of showing the numbers.

the plots don't have to be something very fancy...but instead of
on-line monitoring of the numbers, the output can plot them in "real
time" (as they are being generated)..

I am also trying to stay away from Visual C++ codes...just sticking to
C as much as possible...

I appreaciate your help

Thanks
Freddy


Nov 14 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2848
by: Bob Perlman | last post by:
Hi - I've been getting good results using the DISLIN data plotting package with Python. But I've been unable to plot points instead of curves. Can someone tell me how to turn off the between-points interpolation? And if there is a way to do it, is there a way to change the style of points plotted? Thanks, Bob Perlman
3
5060
by: Erik Lechak | last post by:
Hello All, I am creating a visual programming environment for python (similar to Matlab's simulink, but for python). For several reasons I have decided not to go with OGL. I am writing a wxOGL replacement library for wxPython. My first thought was to create an exact drop in replacement for OGL, but the more I look at the OGL api the more I hesitate to do it.
6
4456
by: Gerrit Holl | last post by:
Hi, I have a dictionairy containing DateTime objects as keys and integers as values. What would be the easiest way to create a simple plot of these, with a number axis versus a time axis? What library is the most suitable for this? 'plot' on parnassus yields 18 hits, but since I have zero experience, I don't know where to start. What makes it difficult is that I have a time axis instead of a simple integer x-axis. Gnuplot doesn't seem...
7
2826
by: Rolf Wester | last post by:
Hi, I have a Python console application that is intended to be used interactively and I have to add plotting capabilities (multiple XY plots and if possible 2D-surface plots). I'm loocking for a reasonably fast plotting library (not GPL'ed, needs not be for free) that can be used under Windows. An alternative would also be a standalone application that can be controlled via TCP/IP from my Python application. I tried matplotlib but this...
11
29560
by: Chapman | last post by:
Is it possible to plot the graph as an output of my program in C? It can be a simple graph as quadratic curves for example or a correlation between 2 variables only. Thanks
1
7072
by: T. Crane | last post by:
Hi, I am looking for a good plotting library. I intend to do 3D surface plots, 2D contour, 3D waterfall, etc. Right now I have access to National Instruments' Measurement Studio, and it's supposed to provide some plotting classes, but I've never used it. Does anyone have any experience with NI's Meas. Studio? Can someone suggest a good plotting library that I might want to use instead of Meas. Studio? Is there a community standard?
1
1595
by: alain44 | last post by:
Hi Can someone help me plotting results on a picturebox using VB.NET ? Based on VB’s help I made up the following code – which works fine as long as the Do-While-loop is disconnected by the ‘Exit Sub’ in line 6 of sub Button1_Click – but if the loop is active as needed for plotting there happens no drawing at all. What’s wrong ??? Public Class AnalResult Dim RcDraw As Rectangle Dim PenWidth As Integer = 4 Dim Warten As...
0
1935
by: Helmut Michels | last post by:
Dear C/C++ programmers, I am pleased to announce version 9.4 of the data plotting software DISLIN. DISLIN is a high-level and easy to use plotting library for displaying data as curves, bar graphs, pie charts, 3D-colour plots, surfaces, contours and maps. Several output formats are supported such as X11, VGA, PostScript, PDF, CGM, WMF, HPGL, TIFF, GIF, PNG, BMP and SVG.
2
2350
archonmagnus
by: archonmagnus | last post by:
Hello all, I've been experimenting with developing an orbital analysis program. Being a visually oriented person, I'd like to translate my (x, y) coordinate pairs to an pixel image array so I can plot the satellite ground tracks on a bitmap, JPEG, PNG, etc. If I simply truncate the values to integers, I'll only have discrete (an most likely) overlapping points rather than line segments that join pixels. Basically, what I'd like to find...
0
10324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9949
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.