Does anyone know how to fix the Y-axis on the serial plotter? I am trying to plot the output of a gas sensor which produces a value of between .15 and 2.5 and ideally I would like the axis to not autoscale and be from 0 to 5. Currently it seems to default to -6 to +6 which makes the changes in the plot line rather small.
I have tried sending it 0 and then 5 as the first voltages but this doesn't seem to help. Ideally it would be incredibly useful if you could set the upper and lower axis on the plotter screen itself in a similar way to setting the baud rate. Also the ability to turn off auto-scaling would be very handy as I almost never want the graph to autoscale.
Has anyone a way of fixing the Y Axis values, and if so can they help here? I have searched the forum and couldn't find an answer.
It can be done by modifying the Arduino IDE and recompiling it. Here is the .java file for anyone interested. It now has a drop-down menu which allows you to enter a range above and below the plotting value. It's not perfect and has a few problems caused by the min/max algorithm used but it's not too bad.(See the screen capture attached)
I have marked the modifications with // DCM so they should be easy to find if you want to tweak them yourself. The original code has practically no comments which makes it rather difficult to work with.
To use the modified plotter replace the file -
~/Arduino/app/src/processing/app/SerialPlotter.java
with the one attached and rebuild the IDE
This is the Mac version so you may need to change the path for Windows and Linux
I stumbled upon a way to do this that doesn't require modifying the IDE. Instead, simply plot min and max lines as additional data. For example, if your raw analog input is between 0 and 800,
...
Serial.print(0); // To freeze the lower limit
Serial.print(" ");
Serial.print(1000); // To freeze the upper limit
Serial.print(" ");
Serial.println(sensorValue); // To send all three 'data' points to the plotter
Great workaround! I'm using it to visualize ECG data
Out of curiously, what's the purpose of the "Serial.print(" ")" command? The y-axis doesn't seem to be fixed at the upper and lower values without it but I'm not entirely sure what the it's there for. Cheers!