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 8 1689
Freddy <zf********@gmail.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.programming.
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.BedBuG.pAlS.INVALID | sed s/[[:upper:]]//g`
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.com, 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
how can I create the ascii graphics...these graphics should be more
than enough...
any help?
Freddy
Freddy <zf********@gmail.com> wrote: how can I create the ascii graphics...these 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.BedBuG.pAlS.INVALID | sed s/[[:upper:]]//g`
"Freddy" <zf********@gmail.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.
> 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.
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**********************@g14g2000cwa.googlegroups. com, «*Freddy*»
<zf********@gmail.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
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**********************@g14g2000cwa.googlegroups. com, «*Freddy*»
<zf********@gmail.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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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
|
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...
|
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...
|
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...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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,...
|
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...
| |