Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unrelated line occures #332

Open
Hit-Mickey opened this issue Dec 4, 2022 · 4 comments
Open

unrelated line occures #332

Hit-Mickey opened this issue Dec 4, 2022 · 4 comments

Comments

@Hit-Mickey
Copy link

When I use the following code ,some problems happened.
1
I just don't need the straight line in the middle,but I don't kown how to correct it,and the following picture is my code:
2
And it's my first time to use matplotlibcpp, so I ask some help to handle the problem.

@taketoe
Copy link

taketoe commented Dec 4, 2022

Hi Hit-Mickey,
Your program doesn't have reached to last number that is 100. So, you see the intermediate plot.
Best regards,
Take

@Hit-Mickey
Copy link
Author

Hit-Mickey commented Dec 4, 2022 via email

@taketoe
Copy link

taketoe commented Dec 4, 2022

Hi,
I understand that you mean just now.
You can solve this problem with no size vector and push_back(..) function.
Best reagard,

#include "matplotlibcpp.h"
namespace plt = matplotlibcpp;
#define N 100
int main(){
	std::vector<double> x,y;
	plt::figure();
	for(int i=0;i<N;i++){
		x.push_back(i);
		y.push_back(log(i));
		plt::clf();
		plt::plot(x,y);
		plt::pause(0.01);
	}
	plt::title("test");
	plt::show();
}

@Hit-Mickey
Copy link
Author

Hit-Mickey commented Dec 4, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants