In gnuplot 5.2.4, I see a problem with the trange in parametric plot and logscale. I used the Windows package gp524-win64-mingw_3.exe .
(I observed that by reactivating a script I successfully run with a 5.0.? version whereit worked fine. Unfortunately, I cannot figure out the patchlevel, but is was before Feb 2017.)
The attempt is to make a parametric plot in logscale. Therefore, a function is used to scale the t-variable in a way that the points are well spread within the range. Thus, I use a trange of [0:1] and scale it in a convenient way. The plotted points are, however, in completly different ranges - it could be [1:100] or so. Here is a small working example:
# x-axis
xmin=600.
xmax=1e5
set xrange [xmin:xmax]
set logscale x
# parametric
set parametric
set trange [0:1]
# scale [0,1] logarithmically to [xmin,xmax]
kot(t) = xmin*exp(t*log(xmax/xmin*1.))
# plot
p \
600+1e3*t, 10.*t w l ls 1, \
kot(t),1+t w l ls 2
The range that are used in the plot are
I checked the following:
show trangetable, I confirmed that the used values of t are not consistent
Bit simpler example, it looks like if logsc is set, the parametric plot does not use t but 10^t
Same behaviour already in 5.2pl0, but not 5.0pl7.
Last edit: Karl Ratzsch 2018-09-24
I may not understand what you are trying for, but I thnk you are applying manually a scaling step that the program already does for you automatically, which results in the scaling being applied twice.
When x is logscaled, the program generates samples that are exponentially spaced so that they come out at equal visual intervals across the plot. I.e. if xrange [1 : 1.e04] then 5 samples would be generated at 1 10 100 1000 10000. Your kot(t) function is applying another exponential on top of that.
Parametric mode is kind of a vestigial relic at this point. Does the plot come out as explected if you instead use '+'?
Dear Ethan,
thank you for the proposed workaround, it worked well. However, the behavior of parametric mode and trange is somewhat unexpected, and seems not be be consistent within the versions 5.0 and 5.2.
As you pointed out that for this specific task, parametric mode is not the only way to do that: I reduced my plotting script to what I thought was a minimal example (although Karl Ratzsch improved that, thanks!), so it was not clear what I was trying to do. In order to clarify the background of my post, I wrote a simplified version of the task - unless I am not sure if this is the appropriate place for it.
In the whole plot, I show functions
Thus my idea was to plot this in parametric mode. However, since x1 and y2 have different ranges, I need to scale the trange in parametric mode by some functions x1scale(t) and y2scale(t)
Here is a working example, the parametric option is commented out, and the '+'-workaround is enabled.
Of course, I'm looking forward also to other solutions to plot simultaneously functions y1(x1) and x1(y2).
Best regards,
Klaus
There's another way to give different sampling ranges for subplots. See also
help special filename.(the keyword "sample" has to be given in front of the first subplot only)
If logsc x is set, '+' generates logspaced datapoints. '++' doesn't do that, but I'm not sure how exactly that is intended to work, the help doesn't mention logscaled sampling (or I didn't read properly).
And if logscale is set, '+' produces a warning
clone_linked_axes called for axes that are not linkdThe details of how the t axis can be explicitly sampled have changed several times, so I would have to go back to the source code for a particular version to see what it does there. In general I suspect that the combination of logscale + sampling + parametric is not as well tested as other plotting modes.
The warning
clone_linked_axes called for axes that are not linkdis harmless. It was a debugging message that was left in the release version by mistake.OK I agree it's a bug, or at least it does not work the way I would expect.
I'll look into it as a possible fix for 5.2.5.
I think I have this working in 5.3 and will back-port the fix for 5.2.5
I notice that the code involved contains comments from a long time ago that ask "Would anyone ever want to set the t axis to log scale?" Is your application a case where the answer is "yes"? The command "set log t" has never been allowed but perhaps it could be in the future.
I would agree: The proposed case is an application where a logscale of the t axis makes sense. Without this option, one has to define an additional log-scaling function as a workaround. Meanwhile, the logscale of the t axis is not necessarily related to the logscale of another axis (like x1). Therefore, I would plead for
set log tas an allowed commandplot '+'option is the far better approachKlaus
I have updateded the develpment snapshot for windows (ver. 5.3).
New snapshot includes the commits
[a3b6a0] [9b43ed] the "logscale perturbs sampling on t" bug hit polar plots also
You can download snapshot windows binary packages from http://www.tatsuromatsuoka.com/gnuplot/Eng/winbin/
and you can test on your windows PC.
Related
Commit: [9b43ed]
Commit: [a3b6a0]
Last edit: Tatsuro MATSUOKA 2018-10-01