| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 425ad08 commit fe9c29c
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,15 @@ | |||
| 1 | + 2017-09-23 Ethan A Merritt <merritt@u.washington.edu> | ||
| 2 | + | ||
| 3 | + * src/axis.c (gen_tics) docs/gnuplot.doc demo/nonlinear6.dem: | ||
| 4 | + Revise documentation of "set xtics" to include examples and description | ||
| 5 | + of logscale keyword. Restore pre-5.2 behaviour that for log-scaled axes | ||
| 6 | + the increment in "set xtics {start,} incr {,end}" is interpreted as a | ||
| 7 | + multiplicative factor rather than a constant interval. However this is | ||
| 8 | + only true if the "logscale" attribute is set for axis tics. | ||
| 9 | + New demo nonlinear6.dem exercises this feature and also shows the use of | ||
| 10 | + "set tics rangelimit" with log-scaled axes. | ||
| 11 | + Bug #1971 | ||
| 12 | + | ||
| 1 | 13 | 2017-09-21 Ethan A Merritt <merritt@u.washington.edu> | |
| 2 | 14 | ||
| 3 | 15 | * term/cairo.trm (cairotrm_reset): Still trying to get this right. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | # | |
| 2 | - # $Id: all.dem,v 1.79 2017-01-11 04:13:58 sfeam Exp $ | ||
| 2 | + # $Id: all.dem,v 1.80 2017-09-23 04:48:03 sfeam Exp $ | ||
| 3 | 3 | # | |
| 4 | 4 | # Executes all demos (OK, MOST demos) in this directory. | |
| 5 | 5 | # This serves as a series of unit tests for non-interactive capabilities. | |
@@ -390,6 +390,7 @@ load "nonlinear2.dem" | |||
| 390 | 390 | load "nonlinear3.dem" | |
| 391 | 391 | load "nonlinear4.dem" | |
| 392 | 392 | load "nonlinear5.dem" | |
| 393 | + load "nonlinear6.dem" | ||
| 393 | 394 | reset | |
| 394 | 395 | ||
| 395 | 396 | print "********************** file transparent.dem *********************" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,21 @@ | |||
| 1 | + # | ||
| 2 | + # Logscale axis tic placement has always been problematic. | ||
| 3 | + # This demo exercises both automatic tic placement and | ||
| 4 | + # user-specified tic series. | ||
| 5 | + # | ||
| 6 | + set log y | ||
| 7 | + set log y2 | ||
| 8 | + set tics nomirror | ||
| 9 | + set border 11 | ||
| 10 | + set key center title "rangelimited tics" samplen -1 | ||
| 11 | + | ||
| 12 | + set xrange [1:15000] | ||
| 13 | + | ||
| 14 | + set ytics 10 logscale rangelimit | ||
| 15 | + set y2tics auto rangelimit | ||
| 16 | + | ||
| 17 | + plot sample [x=2:14000] x axes x1y1 title "set ytics 10", \ | ||
| 18 | + [x=2:14000] x axes x1y2 title "set y2tics auto" | ||
| 19 | + | ||
| 20 | + pause -1 "<cr> to continue" | ||
| 21 | + reset | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - C RCS $Id: gnuplot.doc,v 1.1109 2017-09-19 18:38:01 sfeam Exp $ | ||
| 1 | + C RCS $Id: gnuplot.doc,v 1.1110 2017-09-23 04:48:04 sfeam Exp $ | ||
| 2 | 2 | C | |
| 3 | 3 | C Copyright (C) 1986 - 1993, 1998, 1999, 2000, 2001, 2004 Thomas Williams, Colin Kelley et al. | |
| 4 | 4 | C | |
@@ -13910,6 +13910,7 @@ Ffigure_multiple_keys | |||
| 13910 | 13910 | | ({"<label>"} <pos> {<level>} {,{"<label>"}...) } | |
| 13911 | 13911 | {format "formatstring"} {font "name{,<size>}"} {{no}enhanced} | |
| 13912 | 13912 | { numeric | timedate | geographic } | |
| 13913 | + {{no}logscale} | ||
| 13913 | 13914 | { rangelimited } | |
| 13914 | 13915 | { textcolor <colorspec> } | |
| 13915 | 13916 | unset xtics | |
@@ -13963,10 +13964,32 @@ Ffigure_multiple_keys | |||
| 13963 | 13964 | being displayed; otherwise it has no effect. Any previously specified tic | |
| 13964 | 13965 | frequency or position {and labels} are retained. | |
| 13965 | 13966 | ||
| 13966 | - Positions of the tics are calculated automatically by default or if the | ||
| 13967 | - `autofreq` option is given; otherwise they may be specified in either of | ||
| 13968 | - two forms: | ||
| 13967 | + Tic positions are calculated automatically by default or if the `autofreq` | ||
| 13968 | + option is given. | ||
| 13969 | 13969 | ||
| 13970 | + A series of tic positions can be specified by giving either a tic interval | ||
| 13971 | + alone, or a start point, interval, and end point (see `xtics series`). | ||
| 13972 | + | ||
| 13973 | + Individual tic positions can be specified individually by providing an | ||
| 13974 | + eplicit list of positions, where each position may have an associated | ||
| 13975 | + text label. See `xtics list`. | ||
| 13976 | + | ||
| 13977 | + However they are specified, tics will only be plotted when in range. | ||
| 13978 | + | ||
| 13979 | + Format (or omission) of the tic labels is controlled by `set format`, unless | ||
| 13980 | + the explicit text of a label is included in the `set xtics ("<label>")` form. | ||
| 13981 | + | ||
| 13982 | + Minor (unlabeled) tics can be added automatically by the `set mxtics` | ||
| 13983 | + command, or at explicit positions by the `set xtics ("" <pos> 1, ...)` form. | ||
| 13984 | + | ||
| 13985 | + The appearance of the tics (line style, line width etc.) is determined by the | ||
| 13986 | + border line (see `set border`), even if the tics are drawn at the axes. | ||
| 13987 | + 4 xtics series | ||
| 13988 | + ?set xtics series | ||
| 13989 | + ?xtics series | ||
| 13990 | + Syntax | ||
| 13991 | + set xtics <incr> | ||
| 13992 | + set xtics <start>, <incr>, <end> | ||
| 13970 | 13993 | The implicit <start>, <incr>, <end> form specifies that a series of tics will | |
| 13971 | 13994 | be plotted on the axis between the values <start> and <end> with an increment | |
| 13972 | 13995 | of <incr>. If <end> is not given, it is assumed to be infinity. The | |
@@ -14003,13 +14026,22 @@ Ffigure_multiple_keys | |||
| 14003 | 14026 | Make tics at 1, 100, 1e4, 1e6, 1e8. | |
| 14004 | 14027 | set logscale x; set xtics 1,100,1e8 | |
| 14005 | 14028 | ||
| 14006 | - The explicit ("<label>" <pos> <level>, ...) form allows arbitrary tic | ||
| 14029 | + 4 xtics list | ||
| 14030 | + ?set xtics list | ||
| 14031 | + ?set xtics add | ||
| 14032 | + ?xtics list | ||
| 14033 | + ?xtics add | ||
| 14034 | + Syntax | ||
| 14035 | + set xtics {add} ("label1" <pos1> <level1>, "label2" <pos2> <level2>, ...) | ||
| 14036 | + | ||
| 14037 | + The explicit ("label" <pos> <level>, ...) form allows arbitrary tic | ||
| 14007 | 14038 | positions or non-numeric tic labels. In this form, the tics do not | |
| 14008 | 14039 | need to be listed in numerical order. Each tic has a | |
| 14009 | - position, optionally with a label. Note that the label is | ||
| 14010 | - a string enclosed by quotes. It may be a constant string, such as | ||
| 14011 | - "hello", may contain formatting information for converting the | ||
| 14012 | - position into its label, such as "%3f clients", or may be empty, "". | ||
| 14040 | + position, optionally with a label. | ||
| 14041 | + | ||
| 14042 | + The label is a string enclosed by quotes or a string-valued expression. | ||
| 14043 | + It may contain formatting information for converting the position into its | ||
| 14044 | + label, such as "%3f clients", or it may be the empty string "". | ||
| 14013 | 14045 | See `set format` for more information. If no string is given, the | |
| 14014 | 14046 | default label (numerical) is used. | |
| 14015 | 14047 | ||
@@ -14042,17 +14074,6 @@ Ffigure_multiple_keys | |||
| 14042 | 14074 | ||
| 14043 | 14075 | This will automatically generate tic marks every 0.5 along x, but will | |
| 14044 | 14076 | also add an explicit labeled tic mark at pi. | |
| 14045 | - | ||
| 14046 | - However they are specified, tics will only be plotted when in range. | ||
| 14047 | - | ||
| 14048 | - Format (or omission) of the tic labels is controlled by `set format`, unless | ||
| 14049 | - the explicit text of a label is included in the `set xtics ("<label>")` form. | ||
| 14050 | - | ||
| 14051 | - Minor (unlabeled) tics can be added automatically by the `set mxtics` | ||
| 14052 | - command, or at explicit positions by the `set xtics ("" <pos> 1, ...)` form. | ||
| 14053 | - | ||
| 14054 | - The appearance of the tics (line style, line width etc.) is determined by the | ||
| 14055 | - border line (see `set border`), even if the tics are drawn at the axes. | ||
| 14056 | 14077 | 4 xtics timedata | |
| 14057 | 14078 | ?set xtics timedata | |
| 14058 | 14079 | ?xtics timedata tics | |
@@ -14117,6 +14138,26 @@ Ffigure_multiple_keys | |||
| 14117 | 14138 | To output degrees/minutes/seconds in a context other than axis tics, such as | |
| 14118 | 14139 | placing labels on a map, you can use the relative time format specifiers | |
| 14119 | 14140 | %tH %tM %tS for strptime. See `time_specifiers`, `strptime`. | |
| 14141 | + 4 xtics logscale | ||
| 14142 | + ?set xtics logscale | ||
| 14143 | + ?xtics logscale | ||
| 14144 | + =logscale | ||
| 14145 | + If the `logscale` attribute is set for a tic series along a log-scaled axis, | ||
| 14146 | + the tic interval is interpreted as a multiplicative factor rather than a | ||
| 14147 | + constant. For example: | ||
| 14148 | + # generate a series of tics at y=20 y=200 y=2000 y=20000 | ||
| 14149 | + set log y | ||
| 14150 | + set ytics 20, 10, 50000 logscale | ||
| 14151 | + Note that no tic is placed at y=50000 because it is not in the series 2*10^x. | ||
| 14152 | + If the logscale property is disabled, the tic increment will be treated as | ||
| 14153 | + an additive constant even for a log-scaled axis. For example: | ||
| 14154 | + # generate a series of tics at y=20 y=40 y=60 ... y=200 | ||
| 14155 | + set log y | ||
| 14156 | + set yrange [20:200] | ||
| 14157 | + set ytics 20 nologscale | ||
| 14158 | + The `logscale` attribute is set automatically by the `set log` command, | ||
| 14159 | + so normally you do not need this keyword unless you want to force a | ||
| 14160 | + constant tic interval as in the second example above. | ||
| 14120 | 14161 | 4 xtics rangelimited | |
| 14121 | 14162 | ?set xtics rangelimited | |
| 14122 | 14163 | ?xtics rangelimited | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | #ifndef lint | |
| 2 | - static char *RCSid() { return RCSid("$Id: axis.c,v 1.245 2017-09-11 03:40:51 sfeam Exp $"); } | ||
| 2 | + static char *RCSid() { return RCSid("$Id: axis.c,v 1.246 2017-09-23 04:48:04 sfeam Exp $"); } | ||
| 3 | 3 | #endif | |
| 4 | 4 | ||
| 5 | 5 | /* GNUPLOT - axis.c */ | |
@@ -1106,6 +1106,18 @@ gen_tics(struct axis *this, tic_callback callback) | |||
| 1106 | 1106 | end = step * ceil(lmax / step); | |
| 1107 | 1107 | else | |
| 1108 | 1108 | end = def->def.series.end; | |
| 1109 | + if (def->logscaling) { | ||
| 1110 | + /* This emulates earlier gnuplot versions in handling | ||
| 1111 | + * set log y; set ytics 10 | ||
| 1112 | + */ | ||
| 1113 | + step = eval_link_function(this->linked_to_primary, step); | ||
| 1114 | + end = eval_link_function(this->linked_to_primary, end); | ||
| 1115 | + start = eval_link_function(this->linked_to_primary, start); | ||
| 1116 | + if (!(start > this->linked_to_primary->min)) | ||
| 1117 | + start = this->linked_to_primary->min; | ||
| 1118 | + lmin = this->linked_to_primary->min; | ||
| 1119 | + lmax = this->linked_to_primary->max; | ||
| 1120 | + } | ||
| 1109 | 1121 | } else { | |
| 1110 | 1122 | start = def->def.series.start; | |
| 1111 | 1123 | step = def->def.series.incr; | |
@@ -1253,8 +1265,10 @@ gen_tics(struct axis *this, tic_callback callback) | |||
| 1253 | 1265 | internal = tic; | |
| 1254 | 1266 | user = tic; | |
| 1255 | 1267 | } else if (nonlinear(this)) { | |
| 1256 | - if (def->type == TIC_COMPUTED) | ||
| 1257 | - user = eval_link_function(this->linked_to_primary->linked_to_secondary, tic); | ||
| 1268 | + if (def->type == TIC_SERIES && def->logscaling) | ||
| 1269 | + user = eval_link_function(this, tic); | ||
| 1270 | + else if (def->type == TIC_COMPUTED) | ||
| 1271 | + user = eval_link_function(this, tic); | ||
| 1258 | 1272 | else | |
| 1259 | 1273 | user = tic; | |
| 1260 | 1274 | internal = tic; /* It isn't really, but this makes the range checks work */ | |
@@ -1318,7 +1332,9 @@ gen_tics(struct axis *this, tic_callback callback) | |||
| 1318 | 1332 | } | |
| 1319 | 1333 | ||
| 1320 | 1334 | /* This is where we finally decided to put the tic mark */ | |
| 1321 | - if (nonlinear(this) && (def->type == TIC_COMPUTED)) | ||
| 1335 | + if (nonlinear(this) && (def->type == TIC_SERIES && def->logscaling)) | ||
| 1336 | + position = user; | ||
| 1337 | + else if (nonlinear(this) && (def->type == TIC_COMPUTED)) | ||
| 1322 | 1338 | position = user; | |
| 1323 | 1339 | else | |
| 1324 | 1340 | position = internal; | |
@@ -1351,8 +1367,9 @@ gen_tics(struct axis *this, tic_callback callback) | |||
| 1351 | 1367 | if (this->tictype == DT_TIMEDATE) { | |
| 1352 | 1368 | mtic_user = time_tic_just(this->timelevel - 1, internal + mplace); | |
| 1353 | 1369 | mtic_internal = mtic_user; | |
| 1354 | - } else if (nonlinear(this) && (def->type == TIC_COMPUTED)) { | ||
| 1355 | - /* FIXME: make up for bad calculation of ministart/ministep/miniend */ | ||
| 1370 | + } else if ((nonlinear(this) && (def->type == TIC_COMPUTED)) | ||
| 1371 | + || (nonlinear(this) && (def->type == TIC_SERIES && def->logscaling))) { | ||
| 1372 | + /* Make up for bad calculation of ministart/ministep/miniend */ | ||
| 1356 | 1373 | double this_major = eval_link_function(this, internal); | |
| 1357 | 1374 | double next_major = eval_link_function(this, internal+step); | |
| 1358 | 1375 | mtic_user = this_major + mplace/miniend * (next_major - this_major); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments