Skip to content

Instantly share code, notes, and snippets.

@miguelraz
Created November 3, 2025 03:05
Show Gist options
  • Select an option

  • Save miguelraz/c9cf8858c127783f4db736874c82bb29 to your computer and use it in GitHub Desktop.

Select an option

Save miguelraz/c9cf8858c127783f4db736874c82bb29 to your computer and use it in GitHub Desktop.
A script for plotting

Plotting from Julia with Rust - "Just don't!" version :D

  1. Run julia plotter.jl in a REPL, changing data1 appropriately
  2. Modify your main.rs to dump the interesting files

Otherwise, you can probably setup a loop to redo this every 5 seconds - Makie is fast enough that just parsing and displaying the data should feel pretty fast.

// You dump your interesting numbers into a `data1` file
// I just used bogus data here
use std::io::Write;
use std::{f32::consts::PI, fs::File};
fn main() {
let mut f = File::create("data1").unwrap();
let data1 = (1..=100)
.map(|i| (PI / (i as f32)).to_string())
.collect::<Vec<String>>()
.join("\n");
let _ = writeln!(f, "{data1}");
}
using BetterFileWatching
using GLMakie
watch_file("data1") do _
xs = parse.(Float32, readlines("data1"))
scatter(1:100, xs)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment