Fixing the Y-axis on the serial plotter? Can it be done? Yes it can ( sort of ).

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.

Thanks in advance.

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

SerialPlotter.txt (11.4 KB)

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

2 Likes

Hola. Tambien tengo el mismo problema de escalamiento manual del eje Y.

Dear kintekobo,

Maybe you may send the values to serial plotter, by multiplying them by 10 or 100.

so your range will go up to 15 to 250. you will not deal with the limits 6 and -6.

Best regards.

this is old but if you print a constant value a little bit above you maximum expected value it stays in the screen and the zoom stays fit

Great workaround! I'm using it to visualize ECG data :slight_smile:

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!

It's been a while, but I believe the " " is needed as a separator.

Hi,
This may help;

Tom... :smiley: :+1: :coffee: :australia:

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.