Gnuplot: Różnice pomiędzy wersjami

Usunięte 3460 bajtów ,  10 miesięcy temu
m
m (→‎grid: mv)
fit f(x) "data.dat" u 1:2 via b,c
plot "data.dat" w p, f(x)
 
=grid=
 
Pomoc offline:
 
help grid
 
 
 
 
Szukamy w kodzie źródłowym:
 
grep -lR "grid"
 
znajdujemy pliki:
* gnuplot/src/axis.c
* gnuplot/src/graphics.c
 
 
<syntaxhighlight lang="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;
}
 
</syntaxhighlight>
 
=Kolor=
6532

edycje