|
1 | 1 | #ifndef lint |
2 | | -static char *RCSid() { return RCSid("$Id: axis.c,v 1.242 2017-09-05 20:18:58 sfeam Exp $"); } |
| 2 | +static char *RCSid() { return RCSid("$Id: axis.c,v 1.243 2017-09-10 03:40:01 sfeam Exp $"); } |
3 | 3 | #endif |
4 | 4 |
|
5 | 5 | /* GNUPLOT - axis.c */ |
@@ -196,12 +196,8 @@ check_log_limits(struct axis *axis, double min, double max) |
196 | 196 | void |
197 | 197 | axis_invert_if_requested(struct axis *axis) |
198 | 198 | { |
199 | | - if (((axis->range_flags & RANGE_IS_REVERSED)) |
200 | | - && (axis->autoscale != 0) && (axis->max > axis->min) ) { |
201 | | - double temp = axis->min; |
202 | | - axis->min = axis->max; |
203 | | - axis->max = temp; |
204 | | - } |
| 199 | + if (((axis->range_flags & RANGE_IS_REVERSED)) && (axis->autoscale != 0)) |
| 200 | + reorder_if_necessary(axis->min, axis->max); |
205 | 201 | } |
206 | 202 |
|
207 | 203 |
|
@@ -1087,16 +1083,12 @@ gen_tics(struct axis *this, tic_callback callback) |
1087 | 1083 | double user; /* in user co-ords */ |
1088 | 1084 | double start, step, end; |
1089 | 1085 | int nsteps; |
1090 | | - double lmin = this->min, lmax = this->max; |
1091 | 1086 | double internal_min, internal_max; /* to allow for rounding errors */ |
1092 | 1087 | double ministart = 0, ministep = 1, miniend = 1; /* internal or user - depends on step */ |
| 1088 | + double lmin = this->min, lmax = this->max; |
| 1089 | + |
| 1090 | + reorder_if_necessary(lmin, lmax); |
1093 | 1091 |
|
1094 | | - if (lmax < lmin) { |
1095 | | - /* hmm - they have set reversed range for some reason */ |
1096 | | - double temp = lmin; |
1097 | | - lmin = lmax; |
1098 | | - lmax = temp; |
1099 | | - } |
1100 | 1092 | /* {{{ choose start, step and end */ |
1101 | 1093 | switch (def->type) { |
1102 | 1094 | case TIC_SERIES: |
@@ -1127,6 +1119,7 @@ gen_tics(struct axis *this, tic_callback callback) |
1127 | 1119 | if (nonlinear(this)) { |
1128 | 1120 | lmin = this->linked_to_primary->min; |
1129 | 1121 | lmax = this->linked_to_primary->max; |
| 1122 | + reorder_if_necessary(lmin, lmax); |
1130 | 1123 | this->ticstep = make_tics(this->linked_to_primary, 20); |
1131 | 1124 | /* It may be that we _always_ want ticstep = 1.0 */ |
1132 | 1125 | if (this->ticstep < 1.0) |
@@ -1157,15 +1150,8 @@ gen_tics(struct axis *this, tic_callback callback) |
1157 | 1150 | } |
1158 | 1151 | /* }}} */ |
1159 | 1152 |
|
1160 | | - /* {{{ ensure ascending order */ |
1161 | | - if (end < start) { |
1162 | | - double temp; |
1163 | | - temp = end; |
1164 | | - end = start; |
1165 | | - start = temp; |
1166 | | - } |
| 1153 | + reorder_if_necessary(start, end); |
1167 | 1154 | step = fabs(step); |
1168 | | - /* }}} */ |
1169 | 1155 |
|
1170 | 1156 | if ((minitics != MINI_OFF) && (this->miniticscale != 0)) { |
1171 | 1157 | FPRINTF((stderr,"axis.c: %d start = %g end = %g step = %g base = %g\n", |
|
0 commit comments