pyplot with ion()
@@ -175,12 +175,16 @@ impl Python3_fifo {
fn unblock_plot(&mut self) {
let all_imports = self.imports.clone() + &self.read_previous_code();
+ if self.imports.contains("pyplot") {
+ self.imports = self.imports.clone() + "\nion()\n";
+ }
+
//it's not really pretty but should work most of the time
if all_imports.split_whitespace().collect::<String>().contains("pyplotasplt") {
- self.code = self.code.replace("plt.show()", "plt.pause(0.001);plt.pause(0.001)")
+ self.code = self.code.replace("plt.show()", "plt.show(block=False)")
}
- self.code = self.code.replace("matplotlib.pyplot.show()", "matplotlib.pyplot.plause(0.001);matplotlib.pyplot.pause");
- self.code = self.code.replace("pyplot.show()", "pyplot.plause(0.001);pyplot.pause(0.001)");
+ // self.code = self.code.replace("matplotlib.pyplot.show()", "matplotlib.pyplot.plause(0.001);matplotlib.pyplot.pause");
+ self.code = self.code.replace("pyplot.show()", "pyplot.show(block=False)");
}
