Hello,
Hello,
Hello guys,
I've got a problem that when I try to plot in realtime that I must press "space" or "return" to get a new point!!!
Sorry for my english, I hope you understand me?
Here is the source code:
#include "stdafx.h"
#include "plcdemos.h"
#include <Windows.h>
PLFLT x; // array for x
PLFLT y; // array for y
PLFLT tempx;
PLFLT tempy;
int _tmain(int argc, _TCHAR* argv) // MAIN
{
int i; // counter variable
PLFLT xmin, xmax, ymin, ymax; // min and max Values for x and y
char ver;
for(i=0;i<100;i++) // fills x and y arrays with values
{ // in this example y=x^2
x_= i+1;
y= (i+1) * (i+1);
}
xmin = x;
xmax = x;
ymin = y;
ymax = y;
plgver( ver ); // Get the current library version number
fprintf( stdout, "PLplot library version: %s\n", ver );
plinit(); // Initialize PLplot
plenv(xmin,xmax,ymin,ymax,0,0); // Set up standard window and draw box
for(i=0;i<100;i++)
{
plpoin(i,x,y,0); // Plot a glyph at the specified points
Sleep(10);
}
plclear(); // Clear current (sub)page
plenv(xmin,xmax,ymin,ymax,0,0);
for(i=0;i<100;i++)
{
tempx=i+1;
tempy=(i+1) * (i+1);
plenv(xmin,xmax,ymin,ymax,0,0);
plpoin(1,tempx,tempy,0);
Sleep(10);
}
plclear();
plenv(xmin,xmax,ymin,ymax,0,0); // Set up standard window and draw box
plpoin(100,x,y,0); // Plot a glyph at the specified points
plend(); // End plotting session
return 0;
}
It seems to be a problem with "plenv(…)"
Thanks a lot…_
Hello Kuchi,
I'm not so familiar with PLplot too, but I have a simple question: is this the whole code? I mean, have you previously defined who is x and x (and so on) before giving values to xmin, xmax, ymin and ymax?
Regards,
César.
Hello cesarmv,
I found a bug in my source code but I still doesnt work. It must be:
for(i=0;i<100;i++) // fills x and y arrays with values
{ // in this example y=x^2
x_= i+1;
y= (i+1) * (i+1);
}
The order is ok. I first calculate the values and then I set xmin and so on.
Greets_
x_ and y
why can't I see the brackets?_
Hi Kuchi,
This loop doesn't make sense for me. To define the 100 components of the array x, you must write
for(i=0;i<100;i++) { x[i]=i+1; y[i]=(i+1)*(i+1); }
Did you understand that?
Regards,
César.
x and y
Sorry, I think there's a problem to write brackets () here
Hey Kuchi,
Can you give me your email? I've copied your code and I've made some modifications, and I'd like to show you.
Regards,
César.
Hello Kuchi,
Did you solve your problem? Did you see my last reply?
Regards,
César.