mutating created axes
This is great.
However I ran into a problem where I have to call Axes2D.points() n times, where n is known only at runtime.
I can't figure out how to use the &mut returned by fg.axes2d() -- the figure seems to have permanent ownership. I notice all the examples construct the axes without binding them to a variable.
Is there a way to mutate existing axes in an existing figure?
Can you do:
let mut axes = fg.axes2d();
for i in 0..n
{
axes.points(...);
}
We could add a way to grab axes after you release it, but perhaps this is sufficient?
That results in a borrowing error on fg if you try to .show() it.
I found out you can successfully borrow a reference to fg with a function or closure:
let mut fg = Figure::new();
{
let prep = |fg: &mut Figure| {
let axes: &mut Axes2D = fg.axes2d();
for i in 0..n {
axes.points(...)
}
};
prep(&mut fg);
}
fg.show();
This is an okay workaround for me, maybe call this a low priority issue.
Wouldn't this (haven't tried exactly, but use something similar in my code) work?
let mut fg = Figure::new();
{
let axes = fg.axes2d();
for i in 0..n {
axes.points(...);
}
}
fg.show();