cryoris / matplotlib-cpp Goto Github PK
View Code? Open in Web Editor NEWThis project forked from lava/matplotlib-cpp
Extremely simple yet powerful header-only C++ plotting library built on the popular matplotlib
License: MIT License
This project forked from lava/matplotlib-cpp
Extremely simple yet powerful header-only C++ plotting library built on the popular matplotlib
License: MIT License
Hello,
First, thanks for the great code. It is very helpful to have something nice to visualize the c++ results.
I have go through the code and it seems I am compiling it correctly. However, I am having the following error after the compilation:
"Undefined symbols for architecture arm64:
"_engClose", referenced from:
_main in MatlabPlot-8d1732.o
"_engEvalString", referenced from:
_main in MatlabPlot-8d1732.o
"_engGetVariable", referenced from:
_main in MatlabPlot-8d1732.o
"_engOpen", referenced from:
_main in MatlabPlot-8d1732.o
"_engOutputBuffer", referenced from:
_main in MatlabPlot-8d1732.o
"_engPutVariable", referenced from:
_main in MatlabPlot-8d1732.o
"_mxCreateDoubleMatrix_800", referenced from:
_main in MatlabPlot-8d1732.o
"_mxDestroyArray_800", referenced from:
_main in MatlabPlot-8d1732.o
"_mxGetClassName_800", referenced from:
_main in MatlabPlot-8d1732.o
"_mxGetPr_800", referenced from:
_main in MatlabPlot-8d1732.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)"
I wonder if there is a solution for this. I am running in an M1 MacBook Pro.
Thanks in advance.
my environment:
visual studio2022 use qt to draw image by matplotlibcpp, and i can draw all images in your https://github.com/Cryoris/matplotlib-cpp/readme.md except this one:
#include "../matplotlibcpp.h"
namespace plt = matplotlibcpp;
int main()
{
std::vector<std::vector<double>> x, y, z;
for (double i = -5; i <= 5; i += 0.25) {
std::vector<double> x_row, y_row, z_row;
for (double j = -5; j <= 5; j += 0.25) {
x_row.push_back(i);
y_row.push_back(j);
z_row.push_back(::std::sin(::std::hypot(i, j)));
}
x.push_back(x_row);
y.push_back(y_row);
z.push_back(z_row);
}
plt::plot_surface(x, y, z);
plt::show();
}
the error is said there is a not processed error.
please answer me , thakns
If you use the latest version of Python 3.11, the library calls functions considered obsolete since that version. It is possible to force the compiler to ignore the warning, but this means that these functions may cease to exist at some point.
Calling plt::save(file)
or plt::savefig(file)
returns this error:
terminate called after throwing an instance of 'std::runtime_error'
what(): Call to save() failed.
When compiling a standard example from readthedocs,
#include
#include "matplotlibcpp.h"
namespace plt = matplotlibcpp;
int main() {
std::vector x = {1, 2, 3, 4};
std::vector y = {1, 4, 9, 16};
plt::plot(x, y,"r*");
plt::show();
}
on VisualStudio22 with the ISO C++20 flag and native Python 3.10, I get
Apparently, the compiler cannot decide between
// @brief standard plot function supporting the args (x, y, s, keywords) // line 519
// ...
template <typename VectorX, typename VectorY>
bool plot(const VectorX &x, const VectorY &y, const std::string &s = "",
const std::map<std::string, std::string> &keywords = {}) {
return detail::plot_base(detail::_interpreter::get().s_python_function_plot,
x, y, s, keywords);
}
and
// enable plotting of multiple triples (x, y, format) // line 1953
template <typename A, typename B, typename... Args>
bool plot(const A &a, const B &b, const std::string &format, Args... args) {
return plot(a, b, format) && plot(args...);
}
As I understand, correct me if I'm wrong, there a several constructors, each of which is designed to fall through to the first one above, the one that finally calls plot_base. So, I renamed all constructors but the first one above plot1, and my code now successfully calls plt::plot1 ..... Of course, messing with your library and using non-standard calls on my side is not a proper solution. Rename the fall-through constructor, and I haven't even tested similarily overloaded functions?
If I declare an
Eigen::Matrix _2D_data; /* The initialization does not matter. The first row holds the x-coordinates, and the second row holds the y-
coordinates. */
and I want to call
plt::plot(_2D_data.row(1), _2D_data.row(2));
the resulting plot will not be correct. Around 50% of the points will have their coordinates reversed (the x-coordinates will become y-coordinates and vice-versa).
To correctly plot, I have to write:
Eigen::VectorX x_coords{ _2D_data.row(0) };
Eigen::VectorX y_coords{ _2D_data.row(1) };
plt::plot(x_coords, y_coords);
Thanks for the otherwise great library!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.