Przejdź do zawartości

Gnuplot: Różnice pomiędzy wersjami

Z Wikibooks, biblioteki wolnych podręczników.
Usunięta treść Dodana treść
Linia 456: Linia 456:


gdzie :
gdzie :
* NTSC
* NTSC = gray value : calculated using NTSC coefficients to map RGB onto a grayscale<ref>[http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/POYNTON1/ColorFAQ.html#RTFToC9 Poynton's Color FAQ by Charles Poynton]</ref>
** gray value : calculated using NTSC coefficients to map RGB onto a grayscale<ref>[http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/POYNTON1/ColorFAQ.html#RTFToC9 Poynton's Color FAQ by Charles Poynton]</ref>

** the NTSC luminance, which corresponds to the Y channel in the YIQ model. It indicates the result if the color were displayed on a black-and-white TV screen<ref>[https://livebook.manning.com/book/gnuplot-in-action-second-edition/appendix-d/75 https://livebook gnuplot-in-action-second-edition by P K Janert]</ref>





Wersja z 15:29, 28 gru 2019

gnuplot – program do tworzenia wykresów w 2 i 3 wymiarach.


Jak korzystać z Gnuplota?

Sposoby:

  • bezpośredni
    • interaktywny
    • wywołanie programu z parametrami
  • za pomocą skryptów
  • poprzez inny program


  gnuplot -e "plot sin(x); pause -1"



skrypt basha

Skrypt powłoki Bash:

#!/usr/bin/gnuplot
reset
set terminal svg enhanced background rgb 'white'
set output "test.svg"
test

Kroki:

  • Zapisujemy skrypt jako ( nazwa przykładowa) test.sh.
  • nadajemy atrybut wykonywalności
  • uruchamiamy
 chmod +x test.sh
 ./test.sh


skrypt gnuplota

reset
set terminal svg enhanced background rgb 'white'
set output "test.svg"
test


Kroki:

  • zapisujemy jako test.plt
  • uruchamiamy
 gnuplot "test.plt"

lub po uruchomieniu gnuplota:

 load "test.plt"


Skrypty gnuplota mają rozszerzenia:

  • plt
  • gp
  • gnu

Ustawienia

 show variables all

Przykładowy wynik:

	All available variables:
	pi = 3.14159265358979
	GNUTERM = "wxt"
	NaN = NaN
	GPVAL_TERM = "wxt"
	GPVAL_TERMOPTIONS = "0 enhanced"
	GPVAL_OUTPUT = ""
	GPVAL_ENCODING = "default"
	GPVAL_MINUS_SIGN = "-"
	GPVAL_MICRO = "u"
	GPVAL_DEGREE_SIGN = "\302\260"
	GPVAL_VERSION = 5.0
	GPVAL_PATCHLEVEL = "7"
	GPVAL_COMPILE_OPTIONS = "-READLINE  +LIBEDITLINE  +HISTORY  \n-BACKWARDS_COMPATIBILITY  +BINARY_DATA  \n+GD_PNG  +GD_JPEG  +GD_TTF  +GD_GIF  +ANIMATION  \n-USE_CWDRC  +X11  +X11_POLYGON  +MULTIBYTE  +X11_EXTERNAL +USE_MOUSE  +HIDDEN3D_QUADTREE  \n+DATASTRINGS  +HISTOGRAMS  +OBJECTS  +STRINGVARS  +MACROS  +THIN_SPLINES  +IMAGE  +USER_LINETYPES +STATS +EXTERNAL_FUNCTIONS \n"
	GPVAL_MULTIPLOT = 0
	GPVAL_PLOT = 0
	GPVAL_SPLOT = 0
	GPVAL_TERMINALS = " cairolatex canvas cgm context corel domterm dumb dxf eepic emf emtex epscairo epslatex fig gif hpgl jpeg latex lua mf mp pcl5 pdfcairo png pngcairo postscript pslatex pstex pstricks qms svg tek40xx tek410x texdraw tgif tikz tkcanvas tpic unknown vttek wxt x11 xlib xterm "
	GPVAL_pi = 3.14159265358979
	GPVAL_NaN = NaN
	GPVAL_ERRNO = 1
	GPVAL_ERRMSG = "invalid command"
	GPVAL_PWD = "/home/a"
	GPVAL_LINENO = 0
	ARGC = 0
	ARG0 = ""


katalog

Sprawdzamy położenie roboczego katalogu:

 pwd


Sprawdzamy zawartość roboczego katalogu[1]

 system 'dir'

Terminal

Aktualny ( aktywny) terminal

  show terminal

Przykładowy wynik :

 terminal type is qt 0 font "Sans,9"


Możliwości terminala:

 set output "test.png" 
 test 



Aby zobaczyć listę dostępnych terminali napisz:

set terminal

Przykładowy wynik:

 Available terminal types:
       cairolatex  LaTeX picture environment using graphicx package and Cairo backend
           canvas  HTML Canvas object
              cgm  Computer Graphics Metafile
          context  ConTeXt with MetaFun (for PDF documents)
            corel  EPS format for CorelDRAW
             dumb  ascii art for anything that prints text
              dxf  dxf-file for AutoCad (default size 120x80)
            eepic  EEPIC -- extended LaTeX picture environment
              emf  Enhanced Metafile format
            emtex  LaTeX picture environment with emTeX specials
         epscairo  eps terminal based on cairo
         epslatex  LaTeX picture environment using graphicx package
              fig  FIG graphics language for XFIG graphics editor
              gif  GIF images using libgd and TrueType fonts
             gpic  GPIC -- Produce graphs in groff using the gpic preprocessor
          hp2623A  HP2623A and maybe others
           hp2648  HP2648 and HP2647
             hpgl  HP7475 and relatives [number of pens] [eject]
           imagen  Imagen laser printer
             jpeg  JPEG images using libgd and TrueType fonts
            latex  LaTeX picture environment
              lua  Lua generic terminal driver
               mf  Metafont plotting standard
              mif  Frame maker MIF 3.00 format
               mp  MetaPost plotting standard
             pcl5  HP Designjet 750C, HP Laserjet III/IV, etc. (many options)
         pdfcairo  pdf terminal based on cairo
              png  PNG images using libgd and TrueType fonts
         pngcairo  png terminal based on cairo
       postscript  PostScript graphics, including EPSF embedded files (*.eps)
          pslatex  LaTeX picture environment with PostScript \specials
            pstex  plain TeX with PostScript \specials
         pstricks  LaTeX picture environment with PSTricks macros
              qms  QMS/QUIC Laser printer (also Talaris 1200 and others)
            regis  REGIS graphics language
              svg  W3C Scalable Vector Graphics driver
          tek40xx  Tektronix 4010 and others; most TEK emulators
          tek410x  Tektronix 4106, 4107, 4109 and 420X terminals
          texdraw  LaTeX texdraw environment
             tgif  TGIF X11 [mode] [x,y] [dashed] ["font" [fontsize]]
             tikz  TeX TikZ graphics macros via the lua script driver
         tkcanvas  Tk/Tcl canvas widget [perltk] [interactive]
             tpic  TPIC -- LaTeX picture environment with tpic \specials
          unknown  Unknown terminal type - not a plotting device
            vttek  VT-like tek40xx terminal emulator
            xterm  Xterm Tektronix 4014 Mode

svg

 set terminal svg enhanced background rgb 'white'
 set output "test.svg"
 test

Dane

liczby

Sprawdzamy aktualny format:


   show format


Przykładowy wynik

tic format is:
 x-axis: "% h"
 y-axis: "% h"
 x2-axis: "% h"
 y2-axis: "% h"
 z-axis: "% h"
 cb-axis: "% h"
 r-axis: "% h"


Jak widać standardowym formatem jest:

   "% h%"

czyli spacja potem liczba w formie wykładniczej


Dopuszczalne formaty w wersji 5:[2]

The acceptable formats (if not in time/date mode) are:
Format Explanation
%f floating point notation
%e or %E exponential notation; an "e" or "E" before the power
%g or %G the shorter of %e (or %E) and %f
%h or %H %g with "x10^{%S}" or "*10^{%S}" instead of "e%S". Compare with H in dat/time mode
%x or %X hex
%o or %O octal
%t mantissa to base 10
%l mantissa to base of current logscale
%s mantissa to base of current logscale; scientific power
%T power to base 10
%L power to base of current logscale
%S scientific power
%c character replacement for scientific power
%b mantissa of ISO/IEC 80000 notation (ki, Mi, Gi, Ti, Pi, Ei, Zi, Yi)
%B prefix of ISO/IEC 80000 notation (ki, Mi, Gi, Ti, Pi, Ei, Zi, Yi)
%P multiple of π

data/czas

Sprawdzamy format:

  show timefmt

Przykłądowy wynik:


  Default format for reading time data is "%d/%m/%y,%H:%M"

Tekst

  • Niestandardowe znaki [3][4]
  • wolne odpowiedniki czcionek własnościowych ( ang. proprietary fonts )
    • Times New Roman[5]
    • Arial
    • Courier New[6]

Kolor

Kolor [7]


Nazwy

Zdefiniowane w gnuplocie nazwy i ich znacznei możemy sprawdzić za pomocą komendy :

  show palette colornames


gnuplot>  show palette colornames
	There are 111 predefined color names:
  white              #ffffff = 255 255 255
  black              #000000 =   0   0   0
  dark-grey          #a0a0a0 = 160 160 160
  red                #ff0000 = 255   0   0
  web-green          #00c000 =   0 192   0
  web-blue           #0080ff =   0 128 255
  dark-magenta       #c000ff = 192   0 255
  dark-cyan          #00eeee =   0 238 238
  dark-orange        #c04000 = 192  64   0
  dark-yellow        #c8c800 = 200 200   0
  royalblue          #4169e1 =  65 105 225
  goldenrod          #ffc020 = 255 192  32
  dark-spring-green  #008040 =   0 128  64
  purple             #c080ff = 192 128 255
  steelblue          #306080 =  48  96 128
  dark-red           #8b0000 = 139   0   0
  dark-chartreuse    #408000 =  64 128   0
  orchid             #ff80ff = 255 128 255
  aquamarine         #7fffd4 = 127 255 212
  brown              #a52a2a = 165  42  42
  yellow             #ffff00 = 255 255   0
  turquoise          #40e0d0 =  64 224 208
  grey0              #000000 =   0   0   0
  grey10             #1a1a1a =  26  26  26
  grey20             #333333 =  51  51  51
  grey30             #4d4d4d =  77  77  77
  grey40             #666666 = 102 102 102
  grey50             #7f7f7f = 127 127 127
  grey60             #999999 = 153 153 153
  grey70             #b3b3b3 = 179 179 179
  grey               #c0c0c0 = 192 192 192
  grey80             #cccccc = 204 204 204
  grey90             #e5e5e5 = 229 229 229
  grey100            #ffffff = 255 255 255
  light-red          #f03232 = 240  50  50
  light-green        #90ee90 = 144 238 144
  light-blue         #add8e6 = 173 216 230
  light-magenta      #f055f0 = 240  85 240
  light-cyan         #e0ffff = 224 255 255
  light-goldenrod    #eedd82 = 238 221 130
  light-pink         #ffb6c1 = 255 182 193
  light-turquoise    #afeeee = 175 238 238
  gold               #ffd700 = 255 215   0
  green              #00ff00 =   0 255   0
  dark-green         #006400 =   0 100   0
  spring-green       #00ff7f =   0 255 127
  forest-green       #228b22 =  34 139  34
  sea-green          #2e8b57 =  46 139  87
  blue               #0000ff =   0   0 255
  dark-blue          #00008b =   0   0 139
  midnight-blue      #191970 =  25  25 112
  navy               #000080 =   0   0 128
  medium-blue        #0000cd =   0   0 205
  skyblue            #87ceeb = 135 206 235
  cyan               #00ffff =   0 255 255
  magenta            #ff00ff = 255   0 255
  dark-turquoise     #00ced1 =   0 206 209
  dark-pink          #ff1493 = 255  20 147
  coral              #ff7f50 = 255 127  80
  light-coral        #f08080 = 240 128 128
  orange-red         #ff4500 = 255  69   0
  salmon             #fa8072 = 250 128 114
  dark-salmon        #e9967a = 233 150 122
  khaki              #f0e68c = 240 230 140
  dark-khaki         #bdb76b = 189 183 107
  dark-goldenrod     #b8860b = 184 134  11
  beige              #f5f5dc = 245 245 220
  olive              #a08020 = 160 128  32
  orange             #ffa500 = 255 165   0
  violet             #ee82ee = 238 130 238
  dark-violet        #9400d3 = 148   0 211
  plum               #dda0dd = 221 160 221
  dark-plum          #905040 = 144  80  64
  dark-olivegreen    #556b2f =  85 107  47
  orangered4         #801400 = 128  20   0
  brown4             #801414 = 128  20  20
  sienna4            #804014 = 128  64  20
  orchid4            #804080 = 128  64 128
  mediumpurple3      #8060c0 = 128  96 192
  slateblue1         #8060ff = 128  96 255
  yellow4            #808000 = 128 128   0
  sienna1            #ff8040 = 255 128  64
  tan1               #ffa040 = 255 160  64
  sandybrown         #ffa060 = 255 160  96
  light-salmon       #ffa070 = 255 160 112
  pink               #ffc0c0 = 255 192 192
  khaki1             #ffff80 = 255 255 128
  lemonchiffon       #ffffc0 = 255 255 192
  bisque             #cdb79e = 205 183 158
  honeydew           #f0fff0 = 240 255 240
  slategrey          #a0b6cd = 160 182 205
  seagreen           #c1ffc1 = 193 255 193
  antiquewhite       #cdc0b0 = 205 192 176
  chartreuse         #7cff40 = 124 255  64
  greenyellow        #a0ff20 = 160 255  32
  gray               #bebebe = 190 190 190
  light-gray         #d3d3d3 = 211 211 211
  light-grey         #d3d3d3 = 211 211 211
  dark-gray          #a0a0a0 = 160 160 160
  slategray          #a0b6cd = 160 182 205
  gray0              #000000 =   0   0   0
  gray10             #1a1a1a =  26  26  26
  gray20             #333333 =  51  51  51
  gray30             #4d4d4d =  77  77  77
  gray40             #666666 = 102 102 102
  gray50             #7f7f7f = 127 127 127
  gray60             #999999 = 153 153 153
  gray70             #b3b3b3 = 179 179 179
  gray80             #cccccc = 204 204 204
  gray90             #e5e5e5 = 229 229 229
  gray100            #ffffff = 255 255 255


Gradient koloru

Sprawdzamy jaki mamy standardowy gradient kolorów (tradycyjny pm3d (czarny-niebieski-czerwony-żółty):

show palette

Otrzymujemy:

palette is COLOR
rgb color mapping by rgbformulae are 7,5,15
figure is POSITIVE
all color formulae ARE NOT written into output postscript file
allocating ALL remaining color positions for discrete palette terminals
Color-Model: RGB
gamma is 1.5     

Sprawdzamy jaki gradient ma aktualna paleta:

show palette gradient

Otrzymujemy:

 0. gray=0.0000, (r,g,b)=(0.0000,0.3922,0.0000), #006400 =   0 100   0
 1. gray=0.2500, (r,g,b)=(0.0000,1.0000,0.0000), #00ff00 =   0 255   0
 2. gray=0.2500, (r,g,b)=(1.0000,1.0000,0.0000), #ffff00 = 255 255   0
 3. gray=1.0000, (r,g,b)=(1.0000,0.0000,0.0000), #ff0000 = 255   0   0   



Wykres składowych koloru otrzymamy:

test palette[8]
Standardowy gradient w Gnuplocie

Możemy to zapisać do pliku gif:

set terminal gif
set output 'p.gif'
test palette


gdzie :

  • NTSC
    • gray value : calculated using NTSC coefficients to map RGB onto a grayscale[9]
    • the NTSC luminance, which corresponds to the Y channel in the YIQ model. It indicates the result if the color were displayed on a black-and-white TV screen[10]


Zobaczmy dokładniej jak zbudowany jest gradient.

rgbformulae

Jednym ze składników są funkcje odpowiadające za obliczenie każdej ze składowej koloru. (mimo że nazwy składowych są R,G oraz B to ich znaczenie jest zależne od modelu koloru, tzn. w modelu HSV R będzie oznaczało H). Mamy do dyspozycji 37 wbudowanych funkcji ponumerowanych od 0 do 36 (liczby ujemne dają odwrócony gradient). Możemy je wyświetlić:

show palette rgbformulae

Otrzymamy:

* there are 37 available rgb color mapping formulae:
0: 0               1: 0.5             2: 1
3: x               4: x^2             5: x^3
6: x^4             7: sqrt(x)         8: sqrt(sqrt(x))
9: sin(90x)       10: cos(90x)       11: |x-0.5|
12: (2x-1)^2       13: sin(180x)      14: |cos(180x)|
15: sin(360x)      16: cos(360x)      17: |sin(360x)|
18: |cos(360x)|    19: |sin(720x)|    20: |cos(720x)|
21: 3x             22: 3x-1           23: 3x-2
24: |3x-1|         25: |3x-2|         26: (3x-1)/2
27: (3x-2)/2       28: |(3x-1)/2|     29: |(3x-2)/2|
30: x/0.32-0.78125 31: 2*x-0.84       32: 4x;1;-2x+1.84;x/0.08-11.5
33: |2*x - 0.5|    34: 2*x            35: 2*x - 0.5
36: 2*x - 1
* negative numbers mean inverted=negative colour component
* thus the ranges in `set pm3d rgbformulae' are -36..36
Gorący gradient
Odwrócony gorący gradient


Standardowo są wybrane funkcje nr 7 dla składowej czerwonej, 5 dla składowej zielonej i 15 dla niebieskiej. Możemy wybrać inny zestaw, na przykład proponowany w dokumentacji zestaw "gorący":

set palette rgbformulae 21,22,23

albo odwrócony gradient:

set palette rgbformulae -21,-22,-23


Przykłady

set palette rgb 7,5,15; set title "traditional pm3d\n(black-blue-red-yellow)"; splot g(x)
set palette rgb 3,11,6; set title "green-red-violet"; splot g(x)
set palette rgb 23,28,3; set title "ocean (green-blue-white)\ntry also other permutations"; splot g(x)
set palette rgb 21,22,23; set title "hot (black-red-yellow-white)"; splot g(x)
set palette rgb 30,31,32; set title "color printable on gray\n(black-blue-violet-yellow-white)"; splot g(x)
set palette rgb 33,13,10; set title "rainbow (blue-green-yellow-red)"; splot g(x)
set palette rgb 34,35,36; set title "AFM hot (black-red-yellow-white)"; splot g(x)
set palette model HSV
set palette rgb 3,2,2; set title "HSV model\n(red-yellow-green-cyan-blue-magenta-red)"; splot g(x)
set pal gray; set title "gray palette"; splot g(x)



Definiowanie własnej palety kolorów

set palette defined (0 "dark-green", 1 "green", 1 "yellow", 4 "red")
test palette

Otrzymujemy nieciągły gradient.

Rysowanie danych z pliku

Przygotowanie pliku z danymi

Gnuplot może być używany jako uniwersalny program do rysowania przez inne specjalistyczne programy.

Przygotowanie pliku z danymi w C

Ten program tworzy w swoim katalogu roboczym plik tekstowy data.txt zawierający dane w formacie , który akceptuje gnuplot. Zawiera nagłówek poprzedzony znakiem "#", który przy rysowaniu jest ignorowany, oraz 2 kolumny liczb rozdzielone spacjami.

#include <stdio.h>
#include <stdlib.h>
int main(void) {
  int i;
  double x,y;
  char *output_filename="data.txt";
  FILE *output_file;
  output_file = fopen(output_filename, "w");  
  if (output_file  == NULL) {
    fprintf(stderr, "Nie moge otworzyc %s\n", output_filename);
    getchar();
    return 1;

  } else {
    /* nagłówek */
    fprintf(output_file,"%s %s      %s \n","#","x","y");
    y = 0.005;
    x = 0.0;
    /* 2 kolumny liczb rozdzielone spacjami */
    fprintf(output_file,"% 6.2f % 6.2f \n",x,y);
    for(i=0;i<5;++i) {
      x += y;
      /* 2 kolumny liczb rozdzielone spacjami */
      fprintf(output_file,"% 6.2f % 6.2f \n",x,y);
    }; /* for(i */
  }; /* if ((output_file ... else */
  fclose(output_file);

  fprintf(stderr,"file saved");
  getchar();
  
  
  return 0;
}

Zawartość pliku wygląda następująco:

# x      y 
 0.00   0.01 
 0.01   0.01 
 0.01   0.01 
 0.01   0.01 
 0.02   0.01 
 0.03   0.01

Przygotowanie pliku z danymi w MPSolve

W linii komend (bez uruchomiania gnuplota) wprowadzmy polecenie z opcją -Og:

./unisolve -Og Data/umand31.pol >Results/data.txt

Rysowanie

Przykładowy wykres zawierający dane z pliku oraz wykresy dwóch funkcji

Uruchom gnuplot:

gnuplot

i w linii komend wprowadź polecenie:

plot "data.txt" 

W cudzysłowie jest nazwa pliku, może być poprzedzona ścieżką.

Przykład:

gnuplot
set terminal png
set output "data.png"
set xlabel "x"
set ylabel "y"
set title "My title"
plot "data.txt"


Jeśli polik jest za duży i są problemy z pamięcią możemy użyć tylko niektórych danych , np co 10-ty wiersz:

 pl 'data.txt' u 1:2 every 10

Jeśli dane są w formacie naukowym to możemy je zmienić:

 set format y "%e";

Rysowanie danych bez pliku

Możemy dane wprowadzić bezpośrednio, bez pliku, korzystając z: [11]


gnuplot << EOF
set terminal gif
set output 'plot1.gif'
plot '-' using 1:2
        1 10
        2 20
        3 32
        4 40
        5 50
        e
EOF


lub:

gnuplot -p <(echo -e 'plot "-"\n1 1\ne')

Dopasowanie danych do krzywej

Dopasowanie danych do krzywej (ang. curve fitting)[12]

Przykład: [13]

Podajemy wzór krzywej do której chcemy dopasować punkty zawarte w pliku dane.txt

f1(x) = a*x**3 + b*x**2 + c*x + d

wpisujemy parametry funkcji:

a=1
b=2
c=1
d=1

Znajdujemy dokładniejsze parametry:

fit f1(x) "dane.txt" using 1:2 via a, b, c, d

Wynik tekstowy podaje wiele danych opisujących nowe parametry i ich dopasowanie.


Rysujemy wykres krzywej i punktów:

plot "dane.txt", f1(x)

Wypisujemy nowe wartości parametrów:

 print a, b, c, d


Inny przykład: [14]

 f(x) = exp(-x*c)*b
fit f(x) "data.dat" u 1:2 via b,c
plot "data.dat" w p, f(x)

Mysz

/*
http://www.gnuplot.info/files/gpReadMouseTest.c
gpReadMouseTest.c

Test piped communication and mouse readback with gnuplot.
This code is published under the GNU Public License.

This example demonstrates how to wait for a mouse press and get the
mouse button number and mouse position, from a graph in gnuplot.


Is this still true? Maybe no more necessary:
The weird thing is that the FIFO apparently wants to receive an
initial linefeed from gnuplot before it works. If you uncomment the
one line designated below, it still _may_ work (with emphasis on
"may"). Any ideas why?

*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>

#define wait (printf("Press the 'any' key\n"), fgets(buf, 10, stdin));
#define GPFIFO "./gpio" /* any unique name */

int
main(int argc, char *argv[])
{
FILE  *gp, *gpin;
float mx = 0.0, my = 0.0;
int   mb = 0;
int   n;
char  buf[80];

/* Create a FIFO we later use for communication gnuplot => our program. */
if (mkfifo(GPFIFO, 0600)) {
    if (errno != EEXIST) {
	perror(GPFIFO);
	unlink(GPFIFO);
	return 1;
    }
}

if (NULL == (gp = popen("gnuplot","w"))) {
    perror("gnuplot");
    pclose(gp);
    return 1;
}
puts("Connected to gnuplot.\n");

/* Init mouse and redirect all gnuplot printings to our FIFO */
fprintf(gp, "set mouse; set print \"%s\"\n", GPFIFO);
fflush(gp);

/* Sometimes it was necessary to print \n from gnuplot to avoid a block.
   Probably it is no more necessary.
*/
#if 0
fprintf(gp, "print \"\\n\"\n");
fflush(gp);
#endif

/* Open the FIFO (where gnuplot is writing to) for reading. */
if (NULL == (gpin = fopen(GPFIFO,"r"))) {
    perror(GPFIFO);
    pclose(gp);
    return 1;
}

puts("FIFO open for reading.\n");


/* Now do the work. */
fprintf(gp, "plot sin(x)\n");
fflush(gp);

/* Do it 5 times. */
for (n=0; n<5; n++) {
    printf("\n%i/5. -- Click anywhere in the graph by mouse button 1.\n", n+1);
    fprintf(gp, "pause mouse 'Click mouse!'\n");
    fflush(gp);

    fprintf(stdout,"I'M HERE: %i\n", __LINE__);
    /* Let gnuplot write to coordinates values (to the FIFO). */
    fprintf(gp, "print MOUSE_X, MOUSE_Y, MOUSE_BUTTON\n");
    fflush(gp);

    fprintf(stdout,"I'M HERE: %i\n", __LINE__);
    /* Read from the FIFO. */
    fscanf(gpin, "%f %f %d", &mx, &my, &mb);
    fprintf(stdout,"I'M HERE: %i\n", __LINE__);
    printf("You pressed mouse button %d at x=%f y=%f\n", mb, mx, my);
/*  wait; */
}

fclose(gpin);
pclose(gp);
unlink (GPFIFO);
return 0;
}

/* eof gpReadMouseTest.c */

Problemy

util.c

cannot open file; output not changed
line 25: util.c: No such file or directory

Program ma problem z dostępem do wskazanego pliku/katalogu. Proszę sprawdzić gdzie chcemy zapisać wynikowy plik, prawdopodobnie tam jest błąd[15]

Pomoc

online

offline

terminal

Po uruchomieniu Gnuplota wpisujemy polecenie help lub help nazwa_polecenia. Np. :

 help show


Zobacz również

  • Maxima CAS - program który wykorzystuje gnuplot do tworzenia grafiki

Źródła

  1. stackoverflow question: in-gnuplot-for-windows-how-can-i-list-the-files-in-the-current-working-director
  2. Gnuplot 5 dokumentacja
  3. Gnuplot : ps_guide by Dick Crawford
  4. ymbols in html, latex and gnuplot, along with some acscii codes. by Mathew Peet
  5. askubuntu question: closest-alternative-to-times-new-roman?
  6. linux-font-equivalents-to-popular-web-typefaces by Jonathan Christopher
  7. Wizualizacja danych - Gnuplot, dr hab. Bożena Woźna-SzczeŚniak
  8. /src/command.c
  9. Poynton's Color FAQ by Charles Poynton
  10. https://livebook gnuplot-in-action-second-edition by P K Janert
  11. Stackoverflow : Gnuplotting data without a textfile
  12. gnuplot documentation : page 68 = fit
  13. dopasowanie krzywej z Katedry Biotechnologii Środowiskowej UŚ
  14. stackoverflow question: fitting-a-curve-to-specific-data
  15. stackoverflow questions : gnuplot-nested-do-loop-and-plotting-on-the-same-graph
Commons
Commons