Gnuplot: change power ten prefixes - gnuplot

I have some plots where I have a logarithmic axis ranging from 10^-6 to 10^6. For this, I use the format
set format y '%0.0s\,%c'
which gives the nice power of ten prefixes like micro (u), milli (m), kilo (k) and so on. However, I don't like the 'u' for micro, but I would like to use a 'mu' instead. How can I do this?

Related

Plotting of multiple graphs on a single tablet screen

I m designing an application that is suppose to plot multiple graphs for sensor data on a single tablet screen.All the graphs shall have common x-axis that displays time(1 sec to 2 mins) but y axis data for all the plots is different. I was able to successfully plot all the graphs but not sure how to display a common x- axis for the graphs? Has anyone tried doing this?
You can definitely display multiple plots (each containing it's own graph space) with identical domain (xAxis) labeling. The key to doing this is constraining each plot's boundaries in the same way.
Let's say that for the sake of this example your series data uses a time offset in milliseconds as it's x values. For 1 second that gives us:
xMin = 1000 (1 second)
xMax = 120000 (2 minutes)
which translates to:
plot.setDomainBoundaries(1000, 12000, BoundaryMode.FIXED);
If you're using real timestamps instead of offsets, the same principle applies. You'll just have to decide what the starting timestamp should be and then calculate the ending timestamp by adding 120000 to it.

gnuplot: Replace decimal point by another character

Using gnuplot v4.6.6:
To increase the available space for the actual graph I want to reduce the space required by the y-axis label to the bare minimum.
I'm now using: set format y "%4.1s%c".
Which results in labels like 500.0k. It would be nice if I could reduce this by one more character resulting in labels that look like this : 500k0
However, I can't figure out how to get this. Can it be done, and if so: how?
Thanks for your help.
EDIT: Here's an example graph of what I have now:
For this graph I use set format y "%3.0s%c" which is okay most of the time. But in some cases an extra decimal would be helpful.
You can modify the decimal character:
set decimalsign 'k'
Update:
Or you could plot log10(bits/s);
set yrange[0:9]
set ytics 1
plot 'data.d' using 1:(log10($2))
That would represent everything between 0 bits/s and 10^9 bits/s with a single digit on the y axis...

custom number format in excel for disk or memory sizes

I'm trying to draw a graph where the y-axis is disk sizes.
And I have sizes ranging from 2 kilobytes through about 22 petabytes.
Represented as numbers that is ~2000 to 22e12
This looks pretty bad on a chart axis.
I could set the scale to "thousands" and then I'd be left with numbers between 2 and 22e9 and the reader is left to do the math that 22e9 (thousand) bytes is 22 petabytes and stuff like that.
But that's not intuitive.
So I tried a custom format.
I know that I can do
[Red][>1000000000];[Blue][>1000000]
but only two can be provided in this way.
I also know that I can do stuff for positive, negative and zero as well.
But is there a way in which I can accomplish the following:
(a) cell values are numbers, sizes in bytes, kilobytes or some such unit
(b) graph shows y axis with these numbers
(c) y-axis is logarithmic (very important)
(d) the y-axis labels are converted to K, M, G or P bytes as appropriate
If you think you have a solution, please verify it with this sample data:
1990, 2050
1992, 21246
1993, 208557
1996, 20971520
2000, 306184192
2012, 1.75922E+14
Your graph should be an X-Y Scatter (with lines)
Your graph should include the numbers in the first column as the x-axis on a linear scale
Your graph should include the numbers in the second column as the y-axis on a logarithmic scale
Your graph should have y-axis legends like "1K", "10K", "100K", "1M", "10M", "100M", ... "1P" and so on at the appropriate points.
This same solution would also be obviously applicable for money, where you want to show numbers in thousands, millions or billions with the appropriate suffix and a small number.
Try this to convert a string value in the form 99.9G to 99.9E^9 value
=CHOOSE(SEARCH(RIGHT(B5),"kMG"), 10^3,10^6,10^9)*VALUE(LEFT(B5,LEN(B5)-1))

set gnuplot precision for a specific column

I have a data file with 3 columns and I'd like to plot a 2D map plot. What I do in gnuplot is:
p'datafile' u 1:2:3 with image
for some set of data, the data on the 3rd column (say Z) are different with order of 0.01, e.g 1.56, 1.58, 1.59 etc. I'd like to skip those small difference and consider them all 1.5. How can I set gnuplot to consider only up to one digit after decimal for 3rd column? Thanks!
You can use the floor function to round your numbers down:
plot 'datafile' using 1:2:(floor($3*1e1)/1e1) with image
This sets all your numbers to 1 decimal place. If you wanted to do the same thing for a higher number of decimal places, you could change the 1e1 to 1eN, where N is the number of decimal places you want.

Linear regression for time series with Gnuplot

I am a big fan of Gnuplot and I used it all along my studies for various projects.
Lately I wanted to use Gnuplot to chart some time series like weight loss, exercising results, gas consumptions etc.
Therefore I scale the x-axis like
set xdata time
set timefmt "%d.%m %Y"
set format x "%d.%m"
Now I want to use the fit-function to give me a linear fit. My problem is, that I cannot get that to work if the x-axis is time-related.
Then change the date to a number, for example a number of days starting from the first date, make the fit, and then convert the numbers back again into dates.
That way you'll have "regular" x and y data set.

Resources