Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Interfacing with Matplot++ and SVG display (General questions about displaying graphs)
Interfacing with Matplot++ and SVG display [message #60362] Sat, 23 December 2023 10:14 Go to next message
upbolo is currently offline  upbolo
Messages: 8
Registered: December 2023
Promising Member
Dear all,

These are my very first questions regarding any u++ related things so it is entirely possible I post them at wrong place so I apologies for that. I just started learning u++ by looking at the examples and reading the material on the website. So far I like it and coming from a littler Qt and wxwidgets this may be an easier ride as far as I can tell so far. One of the reasons I chose u++ is because it is platform development. My code has to run on windows 11, linux and Mac OS as well without the hassle of finding the right libraries. The other one is the TheIDE which seems very reasonable at the moment and compiling the examples is super easy on my m2 Mac (This is really nice so far).
One thing I would like to do is scientific plotting of data. So far I used gnuplot and matplot++ in plain STL cpp and my first question regards this. I generated an SVG plot with my plain STL c++ script using matplot++ and then I opened with Inkscape on my m2 Mac and the graph is displayed correctly. After that I compiled the SVGview example with the TheIDE and I tried to display the graph. Everything was displayed apart from the points in the plot. The axes and the title were all correctly displayed but the points were missing. My question is this. Is it possible to display graphs created by matplot++ in u++ especially SVG? I also had a sneak peak of the example FnGraph which ultimately is a solution for me but it may make development faster using an already existing plotting lib.

A non-plotting related question of mine is about where the executable is saved when compiling the examples. It does not save it into the example's folder. How do I tell theIDE where to compile the code?

Also is it possible to use already written plane cpp code which uses the STL? More specifically if I have code which uses STL vector of strings or doubles would I need a class or function which converts these to u++ vector of strings and doubles? I have loads of cpp code written using plane STL cpp and would not like to recode those.

Thanks!

Re: Interfacing with Matplot++ and SVG display [message #60365 is a reply to message #60362] Sun, 24 December 2023 16:08 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Hi upbolo

I will try to answer some of your questions.

Quote:
where the executable is saved when compiling the examples
You can go to menu \Build\Open output directory. Apart from that, you can co to \Build\Output mode, and you can set the full path and name of your exe in DEBUG (left) and RELEASE (right) modes.

Copying data between vectors may be done like this:
// Vectors declaration
std::vector<double> st;
std::Vector<double> up;

// Copying from std to U++
up.SetCount(st.size());
std::copy(Begin(st), End(st), Begin(up));

// Copying from U++ to std
st.resize(up.size());
std::copy(Begin(up), End(up), Begin(st));

Apart from that, for scientific plotting you may use UppHub\Scatter\ScatterDraw. It allows to save as pdf, that has quality valid for scientific journals.


Best regards
Iñaki
Re: Interfacing with Matplot++ and SVG display [message #60373 is a reply to message #60365] Tue, 26 December 2023 12:10 Go to previous messageGo to next message
upbolo is currently offline  upbolo
Messages: 8
Registered: December 2023
Promising Member
Hi,

Thanks, I managed to do most of the things you suggested and it seems to be working well. I got my executable where I wanted and also got familiar with the basic functionalities of theIDE. However The scatterDraw example did not compile. it threw 19 errors connected to type-names such as this:

/u++/theide/UppHub/eigen/plugin/eigen/Eigen/src/Core/arch/NE ON/PacketMath.h (65): error: unknown type name 'float32x4_t'; did you mean 'Upp::float32x4_t'?

I guess I just have to modify the PacketMath.h file if I am not missing anything.

Thanks again,
upbolo
Re: Interfacing with Matplot++ and SVG display [message #60374 is a reply to message #60373] Tue, 26 December 2023 12:48 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Hi upbolo

I am glad that some problems have been corrected.

About the Scatter problem, I wasn't aware of it. Please indicate me details of the operating system and compiler used.


Best regards
Iñaki
Re: Interfacing with Matplot++ and SVG display [message #60375 is a reply to message #60374] Tue, 26 December 2023 12:52 Go to previous messageGo to next message
upbolo is currently offline  upbolo
Messages: 8
Registered: December 2023
Promising Member
Hi again,

I am using an Appel M2 chip with macOS Sonoma 14.2.1. The compiler is clang++ at the moment.

best,
upbolo
Re: Interfacing with Matplot++ and SVG display [message #60376 is a reply to message #60375] Tue, 26 December 2023 13:36 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Hi upbolo

It seems a problem in Eigen library. To confirm it, please try package Eigen/examples/Eigen_demo_cl.
I don't have access to your architecture to test it, but it is like CLANG in ARM has not type float32x4_t, that is used in Eigen.


Best regards
Iñaki
Re: Interfacing with Matplot++ and SVG display [message #60377 is a reply to message #60376] Tue, 26 December 2023 14:07 Go to previous messageGo to next message
upbolo is currently offline  upbolo
Messages: 8
Registered: December 2023
Promising Member
Hi there,

You were right, I am getting the same error for the Eigen demo module as well. I will try with gcc.

Best,
upbolo
Re: Interfacing with Matplot++ and SVG display [message #60378 is a reply to message #60377] Tue, 26 December 2023 15:16 Go to previous messageGo to next message
upbolo is currently offline  upbolo
Messages: 8
Registered: December 2023
Promising Member
Hi,

I tried with gcc and tried make it use the arm_neon.h file but failed. I am going to see how this behaves under plain c++ on my architecture and then probably give up.

Thanks,
upbolo
Re: Interfacing with Matplot++ and SVG display [message #60379 is a reply to message #60378] Tue, 26 December 2023 15:42 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Hi Upbolo

Thank you for your patience.
I will update the Eigen library, which has not been updated for ten months.
When I do, I will let you know and ask you to please do the last test.


Best regards
Iñaki
Re: Interfacing with Matplot++ and SVG display [message #60383 is a reply to message #60379] Wed, 27 December 2023 13:21 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Hi Upbolo

Eigen is now updated. The Eigen PacketMath.h, source of the problems, has been changed significantly.

Please I wanted to ask you to update plugin/Eigen and try Eigen_demo_cl again.
Thank you!


Best regards
Iñaki
Re: Interfacing with Matplot++ and SVG display [message #60387 is a reply to message #60383] Wed, 27 December 2023 16:52 Go to previous messageGo to next message
upbolo is currently offline  upbolo
Messages: 8
Registered: December 2023
Promising Member
Hi there,

Thank you so much! I will test it soon. Meanwhile I did a u++ windows 11 installation and everything worked including Eigen. I will test now on my Mac again.

Best,
upbolo
Re: Interfacing with Matplot++ and SVG display [message #60388 is a reply to message #60387] Wed, 27 December 2023 17:03 Go to previous messageGo to next message
upbolo is currently offline  upbolo
Messages: 8
Registered: December 2023
Promising Member
Hi again,

I reinstalled both Eigen and Scatter and it seems I get the same error as before, unfortunately. I also did plain vanilla install of Eigen 3.4 on my Mac and it worked apart form the umfpack functions.

Best,
upbolo
Re: Interfacing with Matplot++ and SVG display [message #60391 is a reply to message #60388] Wed, 27 December 2023 18:27 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Thank you Upbolo

Unfortunately, the stable version of Eigen, 3.4, is 2.5 years old, and since then until now important features have been added.

In addition, I don't have a computer of your type at my disposal for testing.

I could experiment with changes, but I'd be exhausting your patience by beating around the bush. I don't feel like consulting the Eigen Forum either, because I don't have the equipment to do a simple error test to be able to show them.


Best regards
Iñaki

[Updated on: Wed, 27 December 2023 18:31]

Report message to a moderator

Re: Interfacing with Matplot++ and SVG display [message #60392 is a reply to message #60391] Wed, 27 December 2023 19:45 Go to previous message
upbolo is currently offline  upbolo
Messages: 8
Registered: December 2023
Promising Member
Hi,

Thanks for the effort. I can start developing on my windows 11 box and hope that in the future this issue will be solved for the new apple silicon. I will try to add another numerical math package.

Best,
upbolo
Previous Topic: plugin/tga
Next Topic: Compiling problem in the Draw package
Goto Forum:
  


Current Time: Mon Apr 29 05:05:54 CEST 2024

Total time taken to generate the page: 0.02970 seconds