CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Visualization & Post-Processing (https://www.cfd-online.com/Forums/visualization/)
-   -   what software you use for obtaining graphs by data? (https://www.cfd-online.com/Forums/visualization/120078-what-software-you-use-obtaining-graphs-data.html)

immortality June 30, 2013 03:48

what software you use for obtaining graphs by data?
 
which software is better to draw x-y graphs in ubuntu?(there are columns of data i obtained by postProcessing OF)

julien.decharentenay June 30, 2013 18:13

The answer depends on everyone's opinion/like and dislike. Personally, my preference is gnuplot.

immortality July 1, 2013 05:29

thanks Julien
whats the command for making a graoh of a file containing columns of x and y?
and how can save the graph that is obtained?
can do this in LibreOffice Calc in your opinion?
whats your opinion about SciDAVis?have you worked with it?

flotus1 July 1, 2013 11:21

Quote:

whats the command for making a graoh of a file containing columns of x and y?
For the datafile format you describe, you could start with

Code:

plot 'datafile.dat' using 1:2 with lines
Quote:

and how can save the graph that is obtained?
Depends on what you want exactly.

Code:

set terminal png
set output 'mygraph.png'
replot

will save a .png file of your plot.
For everything beyond this point, my favorite site is:

http://web.archive.org/web/201007261...t/index-e.html

immortality July 1, 2013 11:35

thanks Alex
that site is banned here.could you give me another link?

flotus1 July 1, 2013 13:02

What a pity! This really is the best site for gnuplot.
You could try to google for "gnuplot not so frequently asked questions" and see if there is another archive of this page you are allowed to view.

This would be another one
http://lowrank.net/gnuplot/index-e.html
http://www.ualberta.ca/~xz10/gnuplot/index-e.html

immortality July 1, 2013 13:46

we have both internal and external censorship here!
is this link good enough?http://heim.ifi.uio.no/inf3330/scrip...o/index-e.html
read what parts?

flotus1 July 2, 2013 06:12

This looks like an older version of Kawanos gnuplot site, so yes, it has all the information you need.
Since gnuplot has a learning curve, be prepared to spend a few hours before your first plot looks exactly the way you want it to. Consequently, you will have to start with the "introduction to gnuplot" section.
If you have any specific questions you cant figure out by yourself, feel free to ask.

Yust one hint: put your gnuplot commands in a text file instead of typing them in the shell. This way, you wont have to repeat all commands to produce similar plots.
Load the commands in gnuplot via
load 'textfile.plt'

immortality September 7, 2013 06:32

1 Attachment(s)
I have plot this figure with below commands in a file:
Code:

set terminal png
set output "pressures.png"
set xlabel "time(seconds)"
set ylabel "pressure(pa)"
set title "average-pressures-horizontal lines"
set xrange []
set yrange []
set mxtics 5
set mytics 5
set xtics 0.0004
set ytics 100000
# set zoom .5
plot 'h1.dat' u 1:3 ti 'h1-pressure' w lines linestyle 1,"h2.dat" u 1:3 ti 'h2-pressure' w dots,"h3.dat" u 1:3 ti "h3-pressure" with dots

but it doesn't appear so good,the titles are on graphs,how can make it better?

flotus1 September 7, 2013 07:14

There are many ways to improve on the look of the figure.
First of all, the png-terminal has to go. Try "set terminal pngcairo" instead of "set terminal png".
The figure will look way better with this terminal.

For the key placement and the other options of the key, type "help set key" in gnuplot.
I guess something like "set key outside top right" will do the trick.

And another hint: putting "reset" in the first line of your file will make sure you only get the settings you specify in this file.
Changing the terminal type once again at the end of the file, for example by putting "set terminal wxt" in the last line will prevent some mysterious bugs...

immortality September 7, 2013 07:31

1 Attachment(s)
Thanks Alex,
it is like this now.
how can extend the x axis and decrease legend area? :)

flotus1 September 7, 2013 07:58

I am not sure what you mean by "extend the x-axis"
You could adjust the range
Code:

set xrange [xmin:xmax]
or adjust the size of the plot
Code:

set size xsize,ysize
Type "help margin" for more info on how to adjust the margins of the figure.
And please attach figures as figures ;)

immortality September 7, 2013 08:15

1 Attachment(s)
I want x-axis be longer with more labels,
it shows an error of "invalid file" so I have to compress it so that be in gzip format.

immortality September 7, 2013 15:32

excluding "(" character
 
in U column there are some exess ('s,how can exclude them in gnuplot?
Code:

# Source : sampledSurface sampledSurface
# Faces  : 2800
# Time        sum(magSf)        areaAverage(p)        areaAverage(T)        areaAverage(rho)        areaAverage(h)        areaAverage(U)
0.034525496        0.000207        412747.851309        699.045809721        2.29910981899        426932.686479        (3.98516072783 -1.93539686763 0)
0.034526496        0.000207        412307.846999        698.629256448        2.299132434        426454.791707        (2.86786702681 1.25593261295 0)
0.034527496        0.000207        412530.493165        698.467481475        2.30206486527        426244.44026        (1.83515655768 0.623689287519 0)
0.034528496        0.000207        410317.413572        697.305787988        2.29871440673        424875.712989        (0.975030544888 2.83769037365 0)

this is the error that gnuplot shows:
Code:

gnuplot> load "U.plt"

gnuplot> plot 'h1.dat' u 1:7 ti 'h1-x_Velocity' w l linestyle 1,"h2.dat" u 1:7 ti 'h2-x_Velocity' w l linestyle 2,"h3.dat" u 1:7 ti "h3-x_Velocity" with lp linestyle 3
                                                              ^
        "U.plt", line 29: warning: Skipping data file with no valid points

gnuplot> plot 'h1.dat' u 1:7 ti 'h1-x_Velocity' w l linestyle 1,"h2.dat" u 1:7 ti 'h2-x_Velocity' w l linestyle 2,"h3.dat" u 1:7 ti "h3-x_Velocity" with lp linestyle 3
                                                                                                                ^
        "U.plt", line 29: warning: Skipping data file with no valid points

gnuplot> plot 'h1.dat' u 1:7 ti 'h1-x_Velocity' w l linestyle 1,"h2.dat" u 1:7 ti 'h2-x_Velocity' w l linestyle 2,"h3.dat" u 1:7 ti "h3-x_Velocity" with lp linestyle 3
                                                                                                                                                                      ^
        "U.plt", line 29: warning: Skipping data file with no valid points

gnuplot> plot 'h1.dat' u 1:7 ti 'h1-x_Velocity' w l linestyle 1,"h2.dat" u 1:7 ti 'h2-x_Velocity' w l linestyle 2,"h3.dat" u 1:7 ti "h3-x_Velocity" with lp linestyle 3
                                                                                                                                                                      ^
        "U.plt", line 29: all points y value undefined!


immortality September 7, 2013 16:53

I found this that seems contains what I needmbut its banned!
http://codejourneys.blogspot.com/200...ot-basics.html

flotus1 September 7, 2013 18:30

Quote:

Originally Posted by immortality (Post 450372)
I want x-axis be longer with more labels,
it shows an error of "invalid file" so I have to compress it so that be in gzip format.

Try to play around with the margin settings ("set lmargin a" and "set rmargin b" with low integer values for a and b).
You can also try to adjust the size of the plot by "set size 1.2,1.0" or something in that range.
To control the number of labels, use "set xtics start_value, increment" will do.
Again, gnuplot has some sort of documentation on this topic "help set xtics"

Quote:

Originally Posted by immortality (Post 450429)
in U column there are some exess ('s,how can exclude them in gnuplot?

I dont know if this is possible in gnuplot, but any text editor has a search&replace functionality if you have no influence on the format of the datafile directly.

Quote:

Originally Posted by immortality (Post 450435)
I found this that seems contains what I needmbut its banned!
http://codejourneys.blogspot.com/200...ot-basics.html

The site has some very basic information, but the "not so frequently asked questions" page has the same information and a lot more.

immortality September 8, 2013 05:08

1 Attachment(s)
thanks Alex,
how can increase the distance between points in linepoints style?
in the image points are too close and it seems like a continous line.

immortality September 8, 2013 05:39

1 Attachment(s)
in this data file,some lines aren't in proper position in the column,how can automatically fix it?

immortality September 8, 2013 05:53

and do you mean this site by "not so frequently asked questions"?
http://t16web.lanl.gov/Kawano/gnuplot/index-e.html
it can't be open.

flotus1 September 8, 2013 06:17

Quote:

Originally Posted by immortality (Post 450458)
thanks Alex,
how can increase the distance between points in linepoints style?
in the image points are too close and it seems like a continous line.

This can be achieved wit the "every" plot option.
Code:

plot "datafile.dat" every 5 w p
will only plot every 5th point in your data set.
Edit:
With the linepoints stile, I guess you want to have every data point for the line to have a smooth line but only few points for the points...
I did that plotting the same data twice, once as a line and a second time with points using the every option.
The drawback is that you cant have the same representation of the linestyle in the key automatically as far as I know. Some editing of the figure will be required.

Quote:

Originally Posted by immortality (Post 450459)
in this data file,some lines aren't in proper position in the column,how can automatically fix it?

Why would you need to fix that? Gnuplot doesnt care about the "look" of the datafile as long as there are datafile separators between each column.
The only issue with this datafile are the brackets. But we already had that.

Quote:

Originally Posted by immortality (Post 450461)
and do you mean this site by "not so frequently asked questions"?
http://t16web.lanl.gov/Kawano/gnuplot/index-e.html
it can't be open.

Didnt we find a version of this page that you have access to?
Quote:

we have both internal and external censorship here!
is this link good enough?http://heim.ifi.uio.no/inf3330/scrip...o/index-e.html
read what parts?

immortality September 8, 2013 06:44

4 Attachment(s)
Quote:

Why would you need to fix that? Gnuplot doesnt care about the "look" of the datafile as long as there are datafile separators between each column.
The only issue with this datafile are the brackets. But we already had that.
but it doesn't plot the data files I've attache them by this error:
Code:

gnuplot> plot 'h1.dat' u 1:4 ti 'h1-Temperature' w l linestyle 1,"h2.dat" u 1:4 ti 'h2-Temperature' w l linestyle 2,"h3.dat" u 1:4 ti "h3-Temperature" with lp linestyle 3
                                                                                                                                                                          ^
        "T.plt", line 29: all points y value undefined!

I've attached the gnuplot code used.

immortality September 8, 2013 06:51

3 Attachment(s)
But that works for another case with attached files.
Quote:

I did that plotting the same data twice, once as a line and a second time with points using the every option.
The drawback is that you cant have the same representation of the linestyle in the key automatically as far as I know. Some editing of the figure will be required.
do you mean that its not possible to plot with linepoints style so that line be continuous and points plot every 5 points as you mentioned? then I have to use only points style for that?

immortality September 8, 2013 07:09

this error shown when I added "every" option,what may be the cause?
Code:

gnuplot> load "Ux.plt"

gnuplot> plot 'h1.dat' u 1:7 ti 'h1-x_Velocity' w l linestyle 1,"h2.dat" u 1:7 ti 'h2-x_Velocity' w l linestyle 2,"h3.dat" u 1:7 ti "h3-x_Velocity" every 5 with p linestyle 3
                                                                                                                                                    ^
        "Ux.plt", line 29: ';' expected

gnuplot> gnuplot> load "Ux.plt"

gnuplot> plot 'h1.dat' u 1:7 ti 'h1-x_Velocity' w l linestyle 1,"h2.dat" u 1:7 ti 'h2-x_Velocity' w l linestyle 2,"h3.dat" u 1:7 ti "h3-x_Velocity" every 5 with p linestyle 3
                                                                                                                                                    ^
        "Ux.plt", line 29: ';' expected

gnuplot> gnuplot> load "Ux.plt"

gnuplot> plot 'h1.dat' u 1:7 ti 'h1-x_Velocity' w l linestyle 1,"h2.dat" u 1:7 ti 'h2-x_Velocity' w l linestyle 2,"h3.dat" u 1:7 ti "h3-x_Velocity" every 5 with p linestyle 3
                                                                                                                                                    ^
        "Ux.plt", line 29: ';' expected


flotus1 September 8, 2013 08:53

Quote:

Originally Posted by immortality (Post 450468)
but it doesn't plot the data files I've attache them by this error:
Code:

gnuplot> plot 'h1.dat' u 1:4 ti 'h1-Temperature' w l linestyle 1,"h2.dat" u 1:4 ti 'h2-Temperature' w l linestyle 2,"h3.dat" u 1:4 ti "h3-Temperature" with lp linestyle 3
                                                                                                                                                                          ^
        "T.plt", line 29: all points y value undefined!

I've attached the gnuplot code used.

Seriously, why dont you erase the brackets in the datafiles?

Quote:

Originally Posted by immortality (Post 450470)
But that works for another case with attached files.
...because in these datafiles, there are no brackets...

do you mean that its not possible to plot with linepoints style so that line be continuous and points plot every 5 points as you mentioned? then I have to use only points style for that?

I mean that you cant have the correct representation of that line style in the key automatically, because the line with dots will actually consist of two plots.
With the method I described, the line within the plot will be continuous and contain all data points, while there will only be few points to enhance visibility.

Quote:

Originally Posted by immortality (Post 450472)
this error shown when I added "every" option,what may be the cause?
Code:

gnuplot> load "Ux.plt"

gnuplot> plot 'h1.dat' u 1:7 ti 'h1-x_Velocity' w l linestyle 1,"h2.dat" u 1:7 ti 'h2-x_Velocity' w l linestyle 2,"h3.dat" u 1:7 ti "h3-x_Velocity" every 5 with p linestyle 3
                                                                                                                                                    ^
        "Ux.plt", line 29: ';' expected

gnuplot> gnuplot> load "Ux.plt"

gnuplot> plot 'h1.dat' u 1:7 ti 'h1-x_Velocity' w l linestyle 1,"h2.dat" u 1:7 ti 'h2-x_Velocity' w l linestyle 2,"h3.dat" u 1:7 ti "h3-x_Velocity" every 5 with p linestyle 3
                                                                                                                                                    ^
        "Ux.plt", line 29: ';' expected

gnuplot> gnuplot> load "Ux.plt"

gnuplot> plot 'h1.dat' u 1:7 ti 'h1-x_Velocity' w l linestyle 1,"h2.dat" u 1:7 ti 'h2-x_Velocity' w l linestyle 2,"h3.dat" u 1:7 ti "h3-x_Velocity" every 5 with p linestyle 3
                                                                                                                                                    ^
        "Ux.plt", line 29: ';' expected


I dont think it is a good idea to have the every option at the end of the plot prompt.
Not 100% sure about the correct sequence, so try one of the following
Code:

plot 'h1.dat' u 1:7 w l linestyle 1 t 'h1-x_Velocity',"h2.dat" u 1:7 w l linestyle 2 t 'h2-x_Velocity',"h3.dat" every 5 u 1:7 with p linestyle 3 t "h3-x_Velocity"
plot 'h1.dat' u 1:7 w l linestyle 1 t 'h1-x_Velocity',"h2.dat" u 1:7 w l linestyle 2 t 'h2-x_Velocity',"h3.dat" u 1:7 every 5 with p linestyle 3 t "h3-x_Velocity"


immortality September 8, 2013 09:29

Quote:

Seriously, why dont you erase the brackets in the datafiles?
I don't think it be because of parentheses,because it was plotting other columns without parentheses in previous data files,however I deleted parentheses but the error has remained,although its appearance has changed.:confused:
Code:

gnuplot> plot "p.plt"
              ^
        Bad data on line 1


wyldckat September 8, 2013 09:39

Greetings to all!

I don't have much time to spare today, so I can't play with gnuplot myself :(. Nonetheless, here are the instructions for installing the gnuplot documentation and example on Ubuntu:
  1. Install the documents and examples:
    Code:

    sudo apt-get install gnuplot-doc
  2. Open the main HTML page on Firefox:
    Code:

    firefox /usr/share/doc/gnuplot-doc/html/index.html
    This is the main page for the documentation for gnuplot.
  3. You can find the examples at the folder:
    Code:

    /usr/share/doc/gnuplot-doc/examples/
Good luck! Best regards,
Bruno

immortality September 8, 2013 10:48

Hi
that resolved,the ranges wasn't appropriate,
but I didn't grasp how to set linestyles to have lines and points concurrently and points be less.:confused:

immortality September 8, 2013 11:55

1 Attachment(s)
it resolved,thanks,
the attached is the result with this command:
Code:

plot 'h1.dat' u 1:3 ti 'h1-pressure' w l linestyle 1,"h2.dat" u 1:3 ti 'h2-pressure' w l linestyle 2,"h3.dat" u 1:3 every 20 with lp linestyle 3 t "h3-pressure"

immortality September 9, 2013 05:46

an issue is that the output page that graph is plotted on that has fixed size.
my data's are very high in numbers in x-axis side.I want my graph be wider without need to make it smaller in y-direction by size commands.I want to have a more wider page in fact rather than a smaller graph in the same page output.
is there any way to change dimensions of output page?
it seems it has compacted in x-direction now.

immortality September 9, 2013 08:25

another issue is that is it possible to do some calculations on columns before plotting by gnuplot,like multiplying one column to another column and divide by a constant?

flotus1 September 9, 2013 10:26

Quote:

Originally Posted by immortality (Post 450623)
an issue is that the output page that graph is plotted on that has fixed size.
my data's are very high in numbers in x-axis side.I want my graph be wider without need to make it smaller in y-direction by size commands.I want to have a more wider page in fact rather than a smaller graph in the same page output.
is there any way to change dimensions of output page?
it seems it has compacted in x-direction now.

You can directly specify the size of the png-file.
Code:

set terminal pngcairo size 1200, 600
will result in a a figure of 1200*600 pixels.

Quote:

Originally Posted by immortality (Post 450669)
another issue is that is it possible to do some calculations on columns before plotting by gnuplot,like multiplying one column to another column and divide by a constant?

This works almost the same way as in M$ Excel.
Code:

plot 'h1.dat' u 1:($2*5.0)
will plot plot the second column multiplied by 5 over the first column. The $ character denotes the column number.

immortality September 9, 2013 11:22

thanks Alex,
how I should act if I want to for example subtract two columns in two data files from each other?

flotus1 September 9, 2013 11:51

I have no idea, and apparently, there is no way to do this in gnuplot directly.
But google seems to know another way to do this if you search for "gnuplot compare two files" and hit the first result.
You can be sure that EVERY question you might have concerning gnuplot has already been answered somewhere on the web.

immortality September 9, 2013 12:27

in this link:
http://objectmix.com/graphics/139945...le-figure.html
it says to use: plot '< join fileA.dat fileB.dat' using 1:N+1

immortality September 9, 2013 12:50

how can add all numbers in a column in gnuplot and the number of figures(for obtaining an average of them)?

immortality September 9, 2013 13:08

this page seems to have some information about averaging in gnuplot but is banned here:(
can anyone help to read the page or know about averaging in gnuplot?:)
http://gnuplot-tricks.blogspot.com/

flotus1 September 9, 2013 14:37

1 Attachment(s)
http://www.phyast.pitt.edu/~zov1/gnu...tatistics.html

Quote:

Recently, a patch has been added to gnuplot, with the help of which one make plots with some statistical properties quite easily. Now, the problem with that patch is that, if you do not want to, or cannot take the trouble of compiling gnuplot for yourself, it is no use. However, for most things contained in the patch, there is a work-around that should work in gnuplot 4.2. I will discuss those now.
Determining the minimum, maximum, and the mean
The first thing we will do is to plot the mean, minimum and maximum of a data set. This can easily done in the following way.

Code:

reset
# Produce some dummy data
set sample 200
set table 'stats2.dat'
plot [0:10] 0.5+rand(0)
unset table

set yrange [0:2]
unset key

# Retrieve statistical properties
plot 'stats2.dat' u 1:2
min_y = GPVAL_DATA_Y_MIN
max_y = GPVAL_DATA_Y_MAX

f(x) = mean_y
fit f(x) 'stats2.dat' u 1:2 via mean_y

# Plotting the minimum and maximum ranges with a shaded background
set label 1 gprintf("Minimum = %g", min_y) at 2, min_y-0.2
set label 2 gprintf("Maximum = %g", max_y) at 2, max_y+0.2
set label 3 gprintf("Mean = %g", mean_y) at 2, max_y+0.35
plot min_y with filledcurves y1=mean_y lt 1 lc rgb "#bbbbdd", \
max_y with filledcurves y1=mean_y lt 1 lc rgb "#bbddbb", \
'stats2.dat' u 1:2 w p pt 7 lt 1 ps 1

At the beginning of our script, we just produce some dummy data, and call a dummy plot. This plot does nothing but fills in the values of the minimum and maximum of the data set. Then we fit a constant function. You can convince yourself that this returns the average of the data set.

In the plotting section, we produce three labels, that tell us something about the data set, and plot the data range with shaded region. Easy enough, and in just a couple of lines, we created this figure

immortality September 9, 2013 17:17

thanks Alex,then how I have to use averaging?

immortality September 9, 2013 17:24

I found this also,but isn't clear what have to do exactly.:confused:
http://www.manpagez.com/info/gnuplot...nuplot_419.php

immortality September 11, 2013 17:06

1 Attachment(s)
how can draw two sided arrows for specifying a part of plot parallel to x-direction?(arrow be in x-axis to distinguish a part of plot over a period of time)
for example in the figure attached I want to distinct 0.0347 till 0.0355 by an arrow.
(is there a way to send this type of figures as image?)


All times are GMT -4. The time now is 21:54.