Gnuplot

0% Status
Z Wikibooks, biblioteki wolnych podręczników.

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

Jak korzystać z Gnuplota?[edytuj]

Sposoby:

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


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


Dostęp

  • offline
  • online
    • Gnuplot using the virtual file system VFS, HTML5 and Emscripten ( gnuplot-JS )


skrypt basha[edytuj]

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[edytuj]

Jest to plik tekstowy zawierajacy polecenia gnuplota

Prykład:

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
  • pal ( palety, gradienty)

Ustawienia[edytuj]

 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[edytuj]

Sprawdzamy położenie roboczego katalogu:

 pwd


Sprawdzamy zawartość roboczego katalogu[1]

 system 'dir'

Terminal[edytuj]

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

png[edytuj]

Obsługa ploków png jest dostępna poprzez bibliotekę libgd, która wykorzystuje bibliotekę libpng


Składnia

set terminal png 
       {{no}enhanced}
       {{no}transparent} {{no}interlace}
       {{no}truecolor} {rounded|butt}
       {linewidth <lw>} {dashlength <dl>}
       {tiny | small | medium | large | giant}
       {font "<face> {,<pointsize>}"} {fontscale <scale>}
       {size <x>,<y>} {{no}crop}
       {background <rgb_color>}

Polecenie

set terminal png transparent truecolor enhanced

ustawia:[2]

  • 24 bitowy kolor
  • przezroczyste tło
  • rozszerzony trybu tekstowego, aby kontrolować układ ciągów znaków do wydrukowania.


pngcairo[edytuj]

Terminal png cairo korzysta z bibliotek

Składnia

set term pngcairo
                     {{no}enhanced} {mono|color}
                     {{no}transparent} {{no}crop} {background <rgbcolor>
                     {font <font>} {fontscale <scale>}
                     {linewidth <lw>} {rounded|butt|square} {dashlength <dl>}
                     {pointscale <ps>}
                     {size <XX>{unit},<YY>{unit}}


Przykład[3]

dpi = 300 ## dpi (variable)
width = 90 ## mm (variable)
height = 164.5 ## mm (variable)

in2mm = 25.4 # mm (fixed)
pt2mm = 0.3528 # mm (fixed)

mm2px = dpi/in2mm
ptscale = pt2mm*mm2px
round(x) = x - floor(x) < 0.5 ? floor(x) : ceil(x)
wpx = round(width * mm2px)
hpx = round(height * mm2px)

set terminal pngcairo size wpx,hpx fontscale ptscale linewidth ptscale pointscale ptscale

# PLOT HERE

svg[edytuj]

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

Polecenia[edytuj]


plot[edytuj]

with[edytuj]

 with <style> { {linestyle | ls <line_style>}
                      | {{linetype  | lt <line_type>}
                         {linewidth | lw <line_width>}
                         {linecolor | lc <colorspec>}
                         {pointtype | pt <point_type>}
                         {pointsize | ps <point_size>}
                         {arrowstyle | as <arrowstyle_index>}
                         {fill | fs <fillstyle>} {fillcolor | fc <colorspec>}
                         {nohidden3d} {nocontours} {nosurface}
                         {palette}}
                    }

gdzie

pomoc

  • help with

grid[edytuj]

Pomoc offline:

 help grid



Szukamy w kodzie źródłowym:

 grep -lR "grid"

znajdujemy pliki:

  • gnuplot/src/axis.c
  • gnuplot/src/graphics.c


// graphics.c

static void
place_grid(int layer)
{
    struct termentry *t = term;
    int save_lgrid = grid_lp.l_type;
    int save_mgrid = mgrid_lp.l_type;
    BoundingBox *clip_save = clip_area;

    term_apply_lp_properties(&border_lp);	/* border linetype */
    largest_polar_circle = 0;

    /* We used to go through this process only once, drawing both the grid lines
     * and the axis tic labels.  Now we allow for a separate pass that redraws only
     * the labels if the user has chosen "set tics front".
     * This guarantees that the axis tic labels lie on top of all grid lines.
     */
    if (layer == LAYER_FOREGROUND)
	grid_lp.l_type = mgrid_lp.l_type = LT_NODRAW;

    if (!grid_tics_in_front || (layer == LAYER_FOREGROUND)) {
	/* select first mapping */
	x_axis = FIRST_X_AXIS;
	y_axis = FIRST_Y_AXIS;

	/* label first y axis tics */
	axis_output_tics(FIRST_Y_AXIS, &ytic_x, FIRST_X_AXIS, ytick2d_callback);
	/* label first x axis tics */
	axis_output_tics(FIRST_X_AXIS, &xtic_y, FIRST_Y_AXIS, xtick2d_callback);

	/* select second mapping */
	x_axis = SECOND_X_AXIS;
	y_axis = SECOND_Y_AXIS;

	axis_output_tics(SECOND_Y_AXIS, &y2tic_x, SECOND_X_AXIS, ytick2d_callback);
	axis_output_tics(SECOND_X_AXIS, &x2tic_y, SECOND_Y_AXIS, xtick2d_callback);
    }

    /* select first mapping */
    x_axis = FIRST_X_AXIS;
    y_axis = FIRST_Y_AXIS;

    /* Sep 2018: polar grid is clipped to x/y range limits */
    clip_area = &plot_bounds;

    /* POLAR GRID circles */
    if (R_AXIS.ticmode && (raxis || polar)) {
	/* Piggyback on the xtick2d_callback.  Avoid a call to the full    */
	/* axis_output_tics(), which wasn't really designed for this axis. */
	tic_start = map_y(0);   /* Always equivalent to tics on theta=0 axis */
	tic_mirror = tic_start; /* tic extends on both sides of theta=0 */
	tic_text = tic_start - t->v_char;
	rotate_tics = R_AXIS.tic_rotate;
	if (rotate_tics == 0)
	    tic_hjust = CENTRE;
	else if ((*t->text_angle)(rotate_tics))
	    tic_hjust = (rotate_tics == TEXT_VERTICAL) ? RIGHT : LEFT;
	if (R_AXIS.manual_justify)
	    tic_hjust = R_AXIS.tic_pos;
	tic_direction = 1;
	gen_tics(&axis_array[POLAR_AXIS], xtick2d_callback);
	(*t->text_angle) (0);
    }

    /* POLAR GRID radial lines */
    if (polar_grid_angle > 0) {
	double theta = 0;
	int ox = map_x(0);
	int oy = map_y(0);
	term->layer(TERM_LAYER_BEGIN_GRID);
	term_apply_lp_properties(&grid_lp);
	if (largest_polar_circle <= 0)
	    largest_polar_circle = polar_radius(R_AXIS.max);
	for (theta = 0; theta < 6.29; theta += polar_grid_angle) {
	    int x = map_x(largest_polar_circle * cos(theta));
	    int y = map_y(largest_polar_circle * sin(theta));
	    draw_clip_line(ox, oy, x, y);
	}
	term->layer(TERM_LAYER_END_GRID);
    }

    /* POLAR GRID tickmarks along the perimeter of the outer circle */
    if (THETA_AXIS.ticmode) {
	term_apply_lp_properties(&border_lp);
	if (largest_polar_circle <= 0)
	    largest_polar_circle = polar_radius(R_AXIS.max);
	copy_or_invent_formatstring(&THETA_AXIS);
	gen_tics(&THETA_AXIS, ttick_callback);
	term->text_angle(0);
    }

    /* Restore the grid line types if we had turned them off to draw labels only */
    grid_lp.l_type = save_lgrid;
    mgrid_lp.l_type = save_mgrid;
    clip_area = clip_save;
}

logscale[edytuj]

Składnia:

 set logscale <axes> {<base>}
 unset logscale <axes>
 show logscale

Gdzie

  • base = podstawa logarytmu, domyślnie 10
  • axes = oś

Uwagi

  • znaczniki ( tics) generowane dla osi z logscale nie są równomiernie rozmieszczone. Zobacz: `set xtics`

Przykład: narysuj wykres funkcji wykładniczej y = exp(x)

 plot exp(x)

Możemy przekształcić wykres za pomocą zminy skali osi y z liniowej na logarytmiczną log(y)[4]

 set logscale y
 plot exp(x)
 

Zmina formatu wyświetlania [5]

 set format y "10^{%L}"
 

Pomoc

 help logscale

range[edytuj]

Zakresy ( ang. ranges)

 help ranges
 help xrange
 

Składnia W trybie non-parametric mode:

  plot [<xrange>][<yrange>][<x2range>][<y2range>] ...

W trybie parametric mode:

      plot [<trange>][<xrange>][<yrange>][<x2range>][<y2range>] ...
      

Przykład:

 plot [-pi:pi] [-1.3:1.3] [-1:1] sin(t),t**2
 plot [-5:5][-1:9] exp(x)

Ustawianie wartości

  • lista zakresów za poleceniem plot
  • polecenie set

Składnia

set xrange [{{<min>}:{<max>}}] {{no}reverse} {{no}writeback} {{no}extend} | restore
 show xrange


Lista:

  • xrange
  • yrange
  • zrange
  • x2range
  • y2range
  • cbrange
  • rrange
  • trange
  • urange
  • vrange

Dane

typy[edytuj]

  • datafile
    • text ( non-binary)
    • binary
  • Inline data
  • datablocks

datafile[edytuj]

Tekstowe


Binarne

 show datafile binary filetype


przykładowy wynik:

   This version of gnuplot understands the following binary file types:
	  avs	  bin	  edf	  ehf	  gif	  gpbin	  jpeg	  jpg	  png	  raw	  rgb	  auto

Typy[7]

  • avs: to typ pliku dla obrazów. Składa się z 2 long (xwidth, ywidth), po których następuje strumień pikseli, z których każdy zawiera cztery bajty informacji alfa / czerwony / zielony / niebieski.
  • bin
  • edf[8]
  • ahf
  • gif
  • gpbin
  • jpeg
  • jpg
  • png
  • raw
  • rgb

Format[edytuj]

liczby[edytuj]

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:[9]

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[edytuj]

Sprawdzamy format:

  show timefmt

Przykłądowy wynik:


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

Tekst[edytuj]

  • Niestandardowe znaki [10][11]
  • wolne odpowiedniki czcionek własnościowych ( ang. proprietary fonts )
    • Times New Roman[12]
    • Arial
    • Courier New[13]

Rysowanie danych z pliku[edytuj]

Przygotowanie pliku z danymi[edytuj]

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

Przygotowanie pliku z danymi w C[edytuj]

Ten program tworzy w swoim katalogu roboczym plik tekstowy data.txt zawierający dane w formacie[14] , 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[edytuj]

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

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

Rysowanie[edytuj]

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

Uruchom gnuplot:

gnuplot

i w linii komend wprowadź polecenie, korzystając z różnych stylów rysowania ( ang. Plotting_Styles):[15]

plot "data.txt" 
plot "data.txt" with linespoints 
plot "data.txt" with lines
plot "data.txt" with points 


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";
 
 

Inny przykład wykorzystuje 3 pliki z danymi [16]

unset key
set ylabel "seconds"
set xlabel "algorithm"
set term png font "LMSans10,12" size 1024,1024
set output "full.png"
set title "full view"
plot "./full.dat" using 0:1:(0.5):(column(0)+1):xtic(2) with boxes fs solid lc variable
set output "ejs.png"
set title "embedded julia set view"
plot "./ejs.dat" using 0:1:(0.5):(column(0)+1):xtic(2) with boxes fs solid lc variable
set output "mini.png"
set title "minibrot view"
plot [x=-0.5:2.5] [y=0:50] "./mini.dat" using 0:1:(0.5):(column(0)+1):xtic(2) with boxes fs solid lc variable

Zobacz również:

  • rysowanie danych z kilku plików[17][18]

Rysowanie danych bez pliku[edytuj]

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


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[edytuj]

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

Przykład: [21]

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: [22]

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

Kolor[edytuj]

Kolor [23]

Mysz[edytuj]

/*
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[edytuj]

util.c[edytuj]

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[24]

Bad data[edytuj]

Przyczyny:

  • otwieranie pliku z poleceniami gnuplota za pomocą złej komensy:
    • ( np. *.pal) za pomocą komendy : set palette file "jet.pal". Właściwy sposób to : load "jet.pal"
    • plot a nie load[25]
  • tekst w pliku z danymi[26]


Sprawdzamy w kodzie:

grep -nR --include *.c "bad data" 
src/stats.c:867:	 - using n:m = return two columns, skipping lines w/ bad data
src/stats.c:905:	      int_warn( NO_CARET, "bad data on line %d of file %s",
src/fit.c:1964:	    Eex2("bad data on line %d of datafile", df_line_number);
src/axis.c:302: * but even apart from that autoscaling bad data could cause a fault.

invalid character[edytuj]

  • w pliku jest znak którego nie powinno być, np. tab . Sprawdź plik za pomocą od

Pomoc[edytuj]

online[edytuj]

offline[edytuj]

terminal[edytuj]

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

 help show


Zobacz również[edytuj]

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

Źródła[edytuj]

  1. stackoverflow question: in-gnuplot-for-windows-how-can-i-list-the-files-in-the-current-working-director
  2. docs w3cub: gnuplot complete list terminals
  3. unix.stackexchange question : gnuplot-setting-image-width-with-pixels-for-specific-dpi
  4. GNUPLOT MANUAL: FREQUENTLY USED METHODS by Hiro Shimoyama
  5. not so Frequently Asked Questions
  6. GNUplot_tips_for_nice_looking_charts_from_a_CSV_file by Remy van Elst
  7. apimirror : gnuplot plot data
  8. European Data Format Full specifications
  9. Gnuplot 5 dokumentacja
  10. Gnuplot : ps_guide by Dick Crawford
  11. ymbols in html, latex and gnuplot, along with some acscii codes. by Mathew Peet
  12. askubuntu question: closest-alternative-to-times-new-roman?
  13. linux-font-equivalents-to-popular-web-typefaces by Jonathan Christopher
  14. gnuplot 4.2 doc: Format specifiers
  15. gnuplot.info : Plotting Styles
  16. Practical interior distance rendering by Claude Heiland-Allen
  17. stackoverflow question: gnuplot-plotting-data-from-multiple-input-files-in-a-single-graph
  18. riptutorial : plotting-multiple-data-files
  19. Stackoverflow : Gnuplotting data without a textfile
  20. gnuplot documentation : page 68 = fit
  21. dopasowanie krzywej z Katedry Biotechnologii Środowiskowej UŚ
  22. stackoverflow question: fitting-a-curve-to-specific-data
  23. Wizualizacja danych - Gnuplot, dr hab. Bożena Woźna-SzczeŚniak
  24. stackoverflow questions : gnuplot-nested-do-loop-and-plotting-on-the-same-graph
  25. stackoverflow question: gnuplot-bad-data-on-line-1
  26. ubuntu forums: ] Gnuplot and openoffice
Commons
Commons