Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

## #1250 Some problems about ranges and tics

5.0
open
nobody
None
5
2013-06-20
2013-06-18
Shigeharu TAKENO
No

I reported some problems about ranges and tics of gnuplot-4.6
from M.Yamamoto who wrote a gnuplot book in Japanese.

1) [* < a : b < * ]

For example, in

plot [<-7:13<] sin(x)

graph area become to be extended to [-10:15] automatically,
but the graph is only draw in [-10:10].

2) set logscale & mxtics

On the logscale axis for base 10, "set mxtics <n>" create
expected result. But we can not control by "set mxtics" well
for small log bases (for example, 2, 3, 4, or exp(1)). For
example,

set xrange [1:100]
set logscale x 4
set mxtics 10
plot x

makes 7 (not 9) mini tics between the main tics, and

set logscale x exp(1)
set mxtics 10
plot x

makes not uniform mini tics.

3) writeback

The writeback option of "set *range" seems to be permanent.
For example,

set xrange [-5:5] writeback
set yrange [] writeback
plot sin(x) # this sets yrange to [-1:1] automatically
set xrange [-7:7]
plot 2*cos(x) # this sets yrange to [-2:2] automatically
set xrange restore
set yrange restore
plot x

The xrange and yrange for the last plot are [-7:7] and [-2:2].
But I think it is better the "writeback" is done only when the
keyword is specified.

## Discussion

• The problem 1) may occur by the reason that the timing of
autscaling of xrange for "[<-7:13<]" is done after the sampling
of the function data.

The sampling may be done in eval_plots() (plot2d.c), and do_plot()
is called in the same function after that. But the autoscaling is
done in setup_tics() (axis.c) and the function is called in
do_plot() (-> boundary() -> setup_tics()).

So, the xrange is the default [-10:10] at the sampling step, and it
may become [-10:15] at the plotting.

• Ethan Merritt
2013-06-20

3) writeback

Do you mean that "set xrange [-7:7]" should disable writeback?

• Yes. But this is [not a problem], I mean it is [not better].

I know we can disable it by adding "nowriteback":

set xrange [-5:5] writeback
set yrange [] writeback
plot sin(x) # yrange to [-1:1] and writeback
set xrange [-7:7] nowriteback
set yrange [] nowriteback
plot 2*cos(x) # yrange to [-2:2] but don't writeback
set xrange restore # restore [-5:5]
set yrange restore # restore [-1:1]
plot x

But it doesn't seem to be clear that the trailing plot commands
keep overwriting the "writeback" range without nowriteback.

I like the simple feature such as

set xrange [-1:2] writeback # writeback ON
plot x
set xrange [-2:3] # writeback OFF
replot
set xrange [-2:3] writeback # writeback ON
replot
set xrange [-2:3] # writeback OFF
replot

rather than the current feature

set xrange [-1:2] writeback # writeback ON
plot x
set xrange [-2:3] # writeback ON
replot
set xrange [-2:3] nowriteback # writeback OFF
replot
set xrange [-2:3] # writeback OFF
replot

But, since the current feature is not a problem, it don't have
to be modified.