Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #3568
| From | Ethan A Merritt <sfeam@users.sourceforge.net> |
|---|---|
| Newsgroups | comp.graphics.apps.gnuplot |
| Subject | Re: Strange thing about logscale after a fit ? |
| Date | 2017-03-08 11:01 -0800 |
| Organization | gnuplot development |
| Message-ID | <o9pk87$d37$1@dont-email.me> (permalink) |
| References | <24ea3aba-292c-4afb-a4a8-59685203a23f@googlegroups.com> |
Vincent Gouret wrote:
> Hello all,
>
> I have a strange result for plotting data in logscale. The file I use
> contains this:
> --------------------
> temps_gauss.txt:
>
> 5 100000 4
> 6 69444 4
> 7 51020 4
> 9 30863 5
> 10 24999 5
> 12 17360 6
> 13 14791 7
> 16 9764 9
> 18 7714 11
> 21 5667 15
> 25 3998 22
> 29 2971 31
> 34 2161 47
> 40 1561 70
> 47 1130 110
> 55 825 157
> 64 609 232
> 75 443 361
> 88 321 552
> 103 234 822
> 120 172 1281
> 141 124 2031
> 165 90 3148
> 193 65 4941
> 227 46 7883
> 265 33 12483
> 311 23 19784
> 364 16 31094
> 427 11 50103
> 501 7 80055
> ----------------------
> The first colum is the size of a linear problem, the second is the number
> of random problems of this size and the last is the mean execution time in
> us. The linear problem is solve using the Gauss algorithm. I plot this
> result in Gnuplot with: plot 'temps_gauss.txt' u 1:3 w p It work fine. If
> I want to see the same plot with logscale, I do this: set logscale
> and when I redo the plot, all goes fine. After that, I do a fit like that:
> f(x)=alpha*x**3
> fit f(x) 'temps_gauss.txt' u 1:3 via alpha
> This works well and give me a value for alpha=6.4e-4, fine. Then I plot
> the datas and the model, and at this time it does not work: plot
> 'temps_gauss.txt' u 1:3 w p, f(x) w l This give me the error:
> color axis has cb coord of 0; must be above 0 for log scale!
> If I stop gnuplot, and relaunch it, and type:
> f(x)=alpha*x**3
> set logscale
> alpha=6.4e-4
> plot 'temps_gauss.txt' u 1:3 w p, f(x) w l
> then all goes fine ??? What is the problem ? I use gnuplot V5 patchlevel
> 4, under Windows 8.1 or V5 patchlevel 3 under Lubuntu 16.04.2, the same...
The error occurs because
- the command "set logscale" applies to all axes, not just x and y.
- the default range for all axes in the absence of any input is [-10:10]
- if you actually use an axis in the plot, the program checks that the
range is reasonable, which in the case of log scale means
adjusting the default it to be > 0 if necessary.
- unfortunately (here is the bug) the color axis range is not adjusted
for log scale because your plot does not actually use it. So the
default range is incompatible with log scale and you get an error.
I do not know exactly how long this bug has been there, but I will file
a bug tracker item so that it gets fixed in the next gnuplot release.
To avoid the error, any one of the following is sufficient
- Only set log scale for x and y:
set log xy
- Clear log scale for the color axis:
unset log cb
- Set the range of the color axis to be >0
set cbrange [1:*]
Ethan
Back to comp.graphics.apps.gnuplot | Previous | Next — Previous in thread | Next in thread | Find similar
Strange thing about logscale after a fit ? Vincent Gouret <vincentgouret44@gmail.com> - 2017-03-08 10:07 -0800
Re: Strange thing about logscale after a fit ? Ethan A Merritt <sfeam@users.sourceforge.net> - 2017-03-08 11:01 -0800
Re: Strange thing about logscale after a fit ? Vincent Gouret <vincentgouret44@gmail.com> - 2017-03-08 11:16 -0800
csiph-web