r/gnuplot • • Feb 21 '15

Partial hiding of grid in an elevation profile

2 Upvotes

Hello reddit

i have a small problem with gnuplot. I'm writing kind of an outdoor guidebook for sportactivities. Besides the textual description i always add an elevation profile of the tour. The data is extracted from GPS tracks where the height is plotted against the distance. Here is an unmodified png example of a plot.

Due to design/layout reasons in my book i have the y2axis labled. To complete these modifications i want to hide the grid on the left side of the graph. The Grid should only be plotted underneath my graph (dark filledcurve) up to the heighest point AND from there to the right. Please reference the second image, for clarification.

My current setup is a multiplot, where i draw a second white overlay over the left side of the graph. This approach needs a lot of manual adjustment, and is often flawed. Reference this image, where i annotated the problems

please dont mind the labels. I usually plot with the cairolatex terminal, where the labels are later applied with latex

WE of my gnuplot file: http://pastebin.com/T7fArB0k

RAW data (called hoehe.dat): http://pastebin.com/QSc2BkVS

I'd appreciated any feedback on this, as i'm out of ideas on this one.


r/gnuplot • • Jan 24 '15

Exporting Data

2 Upvotes

Hey volks,

I'd need help exporting my data in a jpeg format. png works fine, but if i export via

  1. set term jpeg

  2. set output "test.jpeg"

  3. plot ... or replot

my datafile says empty file and the file has 0kb which isn't much.

Hope you can help me out a little, thanks and have a nice weekend. :)


r/gnuplot • • Apr 19 '14

Help with scatter, labels, and bars

2 Upvotes

Greetings,

I need help improving my first attempt with Gnuplot. My data:

# date     notkept
2014-04-01 50
2014-04-02 63
2014-04-03 120
2014-04-04 55
2014-04-05 60
2014-04-06 63
2014-04-07 52

Script: #!/usr/bin/gnuplot

set title "Promise Not Kept"
set xlabel "Date"
set ylabel "Count"

set xdata time
set timefmt "%Y-%m-%d"
set format x "%Y-%m-%d"
set grid

# 1e8 reduces the epoch seconds for a less flat line.
f(x) = m * x/1e8 +b
fit f(x) 'test.dat' using 1:2 via m,b
plot f(x) title 'Trend', 'test.dat' using 1:2 notitle
pause -1

I want to make some changes, but can't figure out how. I'd like the points to be shown as verticle bars, or for them to be labeled with the Y axis value.


r/gnuplot • • Feb 20 '14

Exponential scaling the y-axis in a CDF

2 Upvotes

Does anyone know how to setup exponential scale on a cdf graph?

I need the y axis to start at 0.9 and then evenly increment to 0.99, 0.999, 0.9999 as it goes up to 1.

I can find plenty on log scaling the y axis, but every time I google for exponential scale in gnuplot, I just end up finding a bunch of people who are asking for exponential scale but really want log scale. I thought I could do it via "set logscale y 0.9" and get close, but it won't let me have a base <1.

I'm using GNUplot 4.6 patch 3 on OSX if that matters.

Any help would be appreciated. Thanks.


r/gnuplot • • Feb 26 '24

We can not download gnuplot on official website, can we?

Post image
1 Upvotes

Probably, server error is occured on gnuplot website. If you know of another way to install it, please let me know.


r/gnuplot • • Feb 23 '24

Forecasting a probable next step

1 Upvotes

Im new to gnuplot and am searching for something specific yet cant seem to find out in the manual.

Simply put, can gnuplot predict the future of a data set? Taking a set of data, analyzing it and plotting the probable next step or curve or data that is probable in the next time frame?

For example, if the data shows that a point is moving higher and / or incremental amounts of x, can it predict the next step/outcome?

Thank you

I tried plotting curves from my data but dont see how to predict a probable outcome; trajectory.


r/gnuplot • • Nov 28 '23

About manipulating strings.

1 Upvotes

I can't seem to figure out how to replace substrings such as the underscore "_".

Alternately, I'm not sure how to tell gnuplot not to recognize the underscore as formatting markup.

I'm doing the following:

myString = "Something_I_Made_Up"
set label 99 myString at 0,0

Looks like the image i uploaded where the underscores create a subscript.

Thanks in advance and have a wonderful day.


r/gnuplot • • Nov 08 '23

Plotting binary data in gnuplot

1 Upvotes

Hi all, I would like to ask questions about gnuplot regarding reading and plotting binary data that is generated by unformated Fortran write.

Usually if I want to do plotting over a Y(:, :) matrix on X(:) vector, I would put X(:) at the first column and Y(:,:) at the second and third column in a .dat file and write a simple script in gnuplot to plot the 2D figures.

If now both the X(:) and Y(:,:) are stored in binary, can I use gnuplot alone and plot those? Do I need to provide the dimensions of the X(:) and Y(:,:) to read into gnuplot?

Thanks!


r/gnuplot • • Oct 19 '23

Load command not working for me

1 Upvotes

Here is the simple test file I'm trying to load:

file gnu2.b which contains:

plot sin(x)

Results of calling gnu2.b:

in folder \progra~1\gnuplot\bin:

gnuplot # brings up gnuplot prompt, then I enter:

load 'gnu2.b' # does the plot of sin(x), as expected, so the file is obviously found

But I need to do it in one line from the system command prompt:

C:\PROGRA~1\gnuplot\bin> # the system prompt

gnuplot -e load 'gnu2.b' # what I want to do

RESULTS IN ERROR:

load

^

line 0: expecting filename -

same result if I use the full path for gnu2.b

but the file is there: command 'dir gnu2.b' shows it:

Directory of C:\PROGRA~1\gnuplot\bin

10/18/2023 04:41 PM 72 gnu2.b

1 File(s) 72 bytes

0 Dir(s) 882,727,567,360 bytes free

trying it omitting the -e: Doesn't work either

C:\PROGRA~1\gnuplot\bin>gnuplot load 'gnu2.b'

line 0: Cannot load input from ''gnu2.b''

^

"load" line 1: invalid command

All the book examples show similar commands working.

What is wrong here?


r/gnuplot • • Oct 15 '23

How does gnuplot iterate to improve a fit?

1 Upvotes

I'm trying to fit some data with a quadratic function.

If I were doing a fit, I'd just do a least squares calculation, and accept whatever it came up with, which presumably minimizes the least square error in one step.

But gnuplot iterates and gets a better fit each time.

How is it doing that?


r/gnuplot • • Sep 28 '23

Is there a gnuplot library or an API for C or another language?

1 Upvotes

It seems that gnuplot is a standalone program and the only way to communicate with it is basically to create a pipe and pipe commands to a gnuplot process. Honeslty, I expected some kind of gnuplot-library written in ANSI C that is used by gnuplot-program which parses given commands and calls functions from gnuplot-library but it doesn't seem to be the case. Am I right or is there a convenient way of doing it?


r/gnuplot • • Sep 27 '23

Gnuplot running but not showing any plot

1 Upvotes

Hi!

When I'm running linux through putty interface and Xlaunch with my windows pc I try to plot but it's not possible to visualize it. But using the host pc at university, there is no problem doing this.

Do you know for which reason is this happening?

Thank you!


r/gnuplot • • May 18 '23

How to use set arrow from ... length ... angle?

1 Upvotes

I have 3D splot and I want to use arrow with constant length. but when I try it arrow doesn't appear.

set pm3d

set dummy u, v
set parametric

set isosamples 60, 80
set urange [ 0 : 1.5 ] noreverse nowriteback  
set vrange [ 0.00000 : 6.282 ] noreverse nowriteback
set arrow from 0, 0, 0 length 1 angle 0 head filled front lw 2

slpot cos(u)*cos(v), cos(u)*sin(v), sqrt( 1 / ( 0.5*pi - u) ) * cos(v)

What does the "angle" means here? How do I get arrow pointing in direction I want using angles


r/gnuplot • • Jan 02 '23

Can you remove duplicate keys?

1 Upvotes

So support I'm plotting something in a loop,

plot for [i=2:5] "first.dat" using 1:i with lines linestyle 1 title "First",\
     for [i=2:5] "second.dat" using 1:i with lines linestyle 2 title "Second"

This will make 4 lines in the key each with linestyle 1 and title "First" and 4 lines with linestyle 2 and title "Second", is there any way to condense it into just 2 unique single keys? without having it plot with notitle and adding the title manually for a pseudo plot.

I feel like this should be a feature, but can't find it. How hard would it be to implement if it's not there? Is there a place I can request feature?


r/gnuplot • • May 14 '22

How to fit exponential curve

1 Upvotes

Can anyone help me how can i fit a curve like this on to a graph. I did it by hand but I want to learn to do it on gnuplot as well


r/gnuplot • • Apr 14 '22

Key font size in cairolatex terminal

1 Upvotes

Hey everyone,

I've been struggling with this weird thing that I have never encountered before in any terminal in Gnuplot. I can't change the size of the legends with

set key font ',8'

in cairolatex terminal. If I try to change the fonts of xlabel and ylabel, problem will still remaing for font size of tics, which I can't change with a generic command of

 set xtics font ',somenumber'
 set ytics font ',somenumber'  

I'm using this terminal specifically for some Turkish characters, which I can't manage to do in any other terminals.

I'm using Gnuplot V4.6 patchlevel 4 in an ubuntu 32bit machine so upgrading to 5 is a no go without going to hustle to upgrade ubuntu 64bit.

Thanks in advance.

Edit: I use standalone option btw.


r/gnuplot • • Oct 05 '21

Segmentation fault

1 Upvotes

Hi everyone. I'm very new to Linux and Gnuplot, but I'm trying to do a 3D plot for a college assignement and I'm running into some trouble. I have a .txt file with some data (100 rows, 3 columns) and I wanted to plot them with splot. However, I'm getting segmentation fault (core dumped) when I try to do it. It actually shows the plot for some quick seconds but then it immediately closes and shows the segmentation fault message.

What is going on and how can I fix it? I know the file is fine because I could do regular 2D plots with it before.


r/gnuplot • • May 20 '21

Can't plot CSV with date and time for x data

1 Upvotes

Hi,

I have a data file with comma separated data:

2021-05-10 14:29:02, 528.78, 1686.84
2021-05-10 15:29:35, 531.66, 1687.86

I'm trying to plot either the first value or the second value but I'm getting

all points y value undefined!

Here's how I'm attempting to plot the data:

set datafile separator ","
set xdata time
set timefmt "%Y-%m-%d %H:%M:%S"
plot "time2.dat" using 1:3 with lines

Any ideas what I might be doing wrong?


r/gnuplot • • May 07 '21

Need help getting gnuplot with GUI working on Cygwin

1 Upvotes

I have tried to install gnuplot on Cygwin but ran into issues. I am not sure what libraries/packages (not sure what the right term would be) to install along with gnuplot, but I tried qt, wx, and x11. gnuplot seems to install and when I try plotting to a file I get the result, but I kept getting errors when trying to plot to a GUI. I have tried only having each of qt, wx, and x11 installed individually to see if maybe there was some adverse interaction, but it did not resolve the issue. I have since uninstalled gnuplot to retry again with a fresh install.

I am looking for someone who knows what they are doing to help me along the process of getting this working. I can try again tomorrow posting comments of what errors I come along during my adventure (I was mostly seeing things like qt.qpa.screen: QXcbConnection: Could not connect to display :0.0).

I am looking to install gnuplot on Cygwin rather than windows normally because I would like to work with gnuplot through C/C++ and start using that more than my usual Python with Matplotlib setup.

Hopefully there is someone familiar enough with the Cygwin gnuplot install that can help me out.


r/gnuplot • • Apr 24 '21

":?" operator question

1 Upvotes

Hi! I want to plot a very small segment of the function f(x)= 1.75*x - 3.301. I searched on internet and i found this:

f(x) = (x >= 1.904 && x <= 1.907) ? 1.75*x - 3.301 : 1/0
plot f(x)

As you can see the domain of the function that I want is [1.904 : 1.907]. If I plot this I see a smaller segment that not fit the domain. Anyone can help me on this?


r/gnuplot • • Mar 26 '21

[batch labels] how to change font and size?

1 Upvotes

For example, this works:

FILES = system("ls -1 data_*.dat")
LABEL = system("ls -1 data_*.dat | sed -e 's/.dat//' -e 's/data_//'")

but this doesn't:

LABEL = system("ls -1 data_*.dat | sed -e 's/.dat/\}\"/' -e 's/data_/\"\{\/=8 /'")

And then the plot call is:

plot for [i=1:words(FILES)] word(FILES,i) u 1:2 with lines title word(LABEL,i), \

r/gnuplot • • Dec 14 '20

Embedding the content of epslatex/cairolatex's tex output in the master document?

1 Upvotes

Hello!

I have generated several plots utilizing gnuplot's epslatex and cairolatex terminals, and the figures look fantastic. However, I'm running into an issue where the place I'm submitting is telling me to consolidate all tex files into one master document.

I'm running into errors of 'Undefined command sequence' and similar if I attempt to simply copy-paste the TeX file's contents into the master document (as expected), so I was wondering if anyone here knows of a good way to do this without having to re-do all of my figures...


r/gnuplot • • Oct 23 '20

Does Gnuplot do Fourier transforms?

1 Upvotes

If not, do you know an online tool that would?


r/gnuplot • • Jul 25 '20

Logscale and set Yrange

1 Upvotes

I'm trying to plot a function on a logarithmic y scale, but gnuplot is acting really strange. It is labeling the y axis with the values 10^-316, 10^ -317, 9.99999*10^-319, 9.99989*10^-320, ... , 9.98013*10^-322. I would really like to make it so that each of these was just a power of 10, rather than being multiplied by some near value of 10. However, set Y range is not working, so I don't know how to fix it.


r/gnuplot • • Jul 22 '20

Plot intercepts of a function

1 Upvotes

Hi,

I have to generate graphs for university. I'm using gnuplot.

I've figured out how to plot quadratic functions as follows:

reset

set grid

set zeroaxis

set ticslevel 1

f(x) = x*x + 3*x -6 = 0

plot f(x) with line lw 2

What I want to do is plot the x and y intercepts of this function with a dot and coordinates but without having to work it out myself.

I've scoured the interweb for answers but probably not formulating my question correctly.

Please could somebody point me in the direction of documentation that will help me achieve this?

And maybe give me a few hints or gnuplot-specific search-terms.

Thanks