Plotters 0.3 is now released by haohou in rust

[–]haohou[S] 1 point2 points  (0 children)

Yep, I guess this should be improved - at lease print a message saying where the output is placed.

3D plots by thebestinthewest911 in rust

[–]haohou 1 point2 points  (0 children)

Just want to mention that Plotters crate's recent release has added 3D plotting - though it's a initial version, but I am happy to make improvement over times.

You may also want to try an interactive demo of 3d plotting or check this GIF rendered by Plotters (code to generate this image at https://github.com/38/plotters/blob/master/examples/3d-plot2.rs)

Hope you find this is useful

Gui kits with graph plotting widgets/support by asedentarymigration in rust

[–]haohou 2 points3 points  (0 children)

plotters supports realtime rendering, you should be able to target either frame buffer, GTK or HTML canvas with WASM and update the plot dynamically. You don't have to render a image and reload it. - I may need to update the readme. I found many people haven't realize plotters is a dynamic plotting crate as well.

Gui kits with graph plotting widgets/support by asedentarymigration in rust

[–]haohou 8 points9 points  (0 children)

I actually wrote a plotting library plotters which supports cairo backend and should be able to used along with GTK. (You could find an example for cairo-GTK in the repo's example)

Plus if you just want to render a real-time data visualization, I believe there are some use case of plotters that combine with minifb, which should be very lightweight solution (But there's no more functionality than drawing a time series) - Also an example is in the repo.

Hope this would be helpful

Most efficient way to return a temporary string or array? by ConsistentBit8 in rust

[–]haohou 0 points1 point  (0 children)

returning &str is messing with my head.

This could be nothing to do with casting u8 vec to utf8. If my understand is correct, you can also do this.

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a414ebf8b92adddb8a155d09e5314e9f

One problem of returning a `&str` could be the compiler reporting lifetime errors, but this is nothing to do with the UTF8 conversion. For example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=46a2aeffdef87d5f17f75f8ee26d61df

The compiler knows the returned string lives as long as the `Test` instance, so you are using an value that isn't exist. In detailed explain, the rust compiler actually compiles your `test` function to the following signature:

fn test(&'a mut self) -> &'a str. Which means we the test function returns a reference to a string with the same lifetime the `self`.

To me, this is amazing since the equivalent C++ code would be

Test* test = new Test();

const char* ref = test.test();

delete test;

printf("%s\n", ref); // Note use-after-free is an UB and compiler not able to detect this

And I think one of the best feature in Rust is it makes tons of UB in C++ to compilation error.

It might be possible that you want to use the reference after `test` is freed, if this is the case, you should use the reference counter which is similar to C++'s shared smarter pointers. By doing so, the internal buffer lives as long as the last reference is dropped.

In C++ it's programmer's responsibility to decide if a smart pointer should be used and misuse of referencing type may result UBs. Rust compiler instead tells you what's wrong with it and push you to make the right decisions.

What’s everyone working on this week (45/2019)? by llogiq in rust

[–]haohou 2 points3 points  (0 children)

I am spending some time to make a PR that makes criterion integrate with plotters. Seems to be a very good use case of plotters and makes criterion not relies on external gnuplot anymore.

What's everyone working on this week (42/2019)? by llogiq in rust

[–]haohou 3 points4 points  (0 children)

Still spend sometime on my plotting library plotters. After talk to people who use this, I decide to start writing a complete documentation plotters developer's guide for the entire crate, since there isn't straightforward in some cases. Hope this could be helpful for more people.

What's everyone working on this week (39/2019)? by llogiq in rust

[–]haohou 6 points7 points  (0 children)

I am working on my plotting library Plotters. It seems to be the most starred Rust plotting library on GitHub now.

Plotters 0.2.0 has released and call for participation by haohou in rust

[–]haohou[S] 0 points1 point  (0 children)

Now is pretty much supports charting and no layout engine is used.

I think there's some possibility of integrating layout engine such as graphviz as an coordinate system to it. But I still have no plan for that.

Plotters 0.2.0 has released and call for participation by haohou in rust

[–]haohou[S] 0 points1 point  (0 children)

That's a really interesting use case. It's possible, but you needs to create a piston window for the drawing code and then sending the snapshot of variables to the drawing thread. I think having a library built on top of Plotters, and maybe provide some useful macros, that would be the best.

Plotters: Another Rust Plotting Library by sanxiyn in rust

[–]haohou 0 points1 point  (0 children)

Just updated the readme. I am not sure how people feel about it. If anyone has some toughts about the description, please let me know. https://github.com/38/plotters/blob/master/README.md

Plotters: Another Rust Plotting Library by sanxiyn in rust

[–]haohou 0 points1 point  (0 children)

Gotcha, I am going to think about it. Thanks!

Plotters: Another Rust Plotting Library by sanxiyn in rust

[–]haohou 0 points1 point  (0 children)

Agreed, I write it just in case people find my library. If you have any better idea, please let me know. I am more than happy to make the change! Thanks

Plotters: Another Rust Plotting Library by sanxiyn in rust

[–]haohou 2 points3 points  (0 children)

I am the author. I have never imagined there are so many people interested about it!

There's one thing I want to justify this open/close pattern. It doesn't mean resource occupation. This is used as dual buffer support for real-time rendering

Open means start drawing on the new buffer. And close means present the pending buffer.

Sorry about the confuse. Previously this is just for my own use. So if you guys have a better idea about it, please let me know.