Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #1559 > unrolled thread

Image or special files do not work on y2 axis?

Started byIngo Thies <ingo.thies@gmx.de>
First post2012-12-29 15:06 +0100
Last post2013-01-01 13:36 +0100
Articles 5 — 2 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  Image or special files do not work on y2 axis? Ingo Thies <ingo.thies@gmx.de> - 2012-12-29 15:06 +0100
    Re: Image or special files do not work on y2 axis? sfeam <sfeam@users.sourceforge.net> - 2012-12-29 14:15 -0800
      Re: Image or special files do not work on y2 axis? Ingo Thies <ingo.thies@gmx.de> - 2012-12-30 11:12 +0100
        Re: Image or special files do not work on y2 axis? sfeam <sfeam@users.sourceforge.net> - 2012-12-31 12:09 -0800
          Re: Image or special files do not work on y2 axis? Ingo Thies <ingo.thies@gmx.de> - 2013-01-01 13:36 +0100

#1559 — Image or special files do not work on y2 axis?

FromIngo Thies <ingo.thies@gmx.de>
Date2012-12-29 15:06 +0100
SubjectImage or special files do not work on y2 axis?
Message-ID<ak8bmvFf1e8U1@mid.individual.net>
Dear all,

I am currently trying to trick a gradient fill below a curve by the 
following method:

f(x)=-x*x+1.
xmin=-1.;xmax=1.
ymin=0.;ymax=1.2
set xrange [xmin:xmax];set cbrange [xmin:xmax]
set y2range [0:1]#dummy yrange
#set palette defined ( 0 "blue", 3 "green", 6 "yellow", 10 "red" )
set palette file 'RGB_palettes/rainbow.gpf' u 1:2:3:4; set xrange 
[xmin:xmax];set cbrange [xmin:xmax]
#set yrange [ymin:ymax]#actual yrange using y2 axis
set yrange [0:*]
unset colorbox
unset y2tics; set ytics autofreq
plot '++' using 1:2:1 axes x1y2 with image,\
f(x) axes x1y1 notitle w filledcurves below y1=ymax lc rgb "white",\
f(x) axes x1y1 t 'f(x)' w l lc rgb "#000000"

While this works without problem for the "palette defined ..." method it 
fails for "palette file ...", with an error message "y range is 
invalid". However, if I exchange y1 and y2 axes it works. My guess: 
gnuplot can define file dummy files of the type '++' and similar 
properly only if axes x1y1 is used. Otherwise the palette specification 
fails. Did I found a bug here? Or is there a bug in the script above?

IngO

[toc] | [next] | [standalone]


#1560

Fromsfeam <sfeam@users.sourceforge.net>
Date2012-12-29 14:15 -0800
Message-ID<kbnq29$kqb$1@dont-email.me>
In reply to#1559
Ingo Thies wrote:

> Dear all,
> 
> I am currently trying to trick a gradient fill below a curve by the
> following method:
> 
> f(x)=-x*x+1.
> xmin=-1.;xmax=1.
> ymin=0.;ymax=1.2
> set xrange [xmin:xmax];set cbrange [xmin:xmax]
> set y2range [0:1]#dummy yrange
> #set palette defined ( 0 "blue", 3 "green", 6 "yellow", 10 "red" )
> set palette file 'RGB_palettes/rainbow.gpf' u 1:2:3:4; set xrange
> [xmin:xmax];set cbrange [xmin:xmax]
> #set yrange [ymin:ymax]#actual yrange using y2 axis
> set yrange [0:*]
> unset colorbox
> unset y2tics; set ytics autofreq
> plot '++' using 1:2:1 axes x1y2 with image,\
> f(x) axes x1y1 notitle w filledcurves below y1=ymax lc rgb "white",\
> f(x) axes x1y1 t 'f(x)' w l lc rgb "#000000"
> 
> While this works without problem for the "palette defined ..." method
> it fails for "palette file ...", with an error message "y range is
> invalid". However, if I exchange y1 and y2 axes it works. My guess:
> gnuplot can define file dummy files of the type '++' and similar
> properly only if axes x1y1 is used. Otherwise the palette
> specification fails. Did I found a bug here? Or is there a bug in the
> script above?

I believe the problem is that autoscaling (set yrange [0:*])
cannot be combined with either sampling (plot '++' ...) 
It requires an explicit range over which the samples are generated.

If I add an explicit range before the plot command so that the sampling
is well defined, then I find that your plot command works with either the
the y1 or y2 axis.

set palette defined ...   # either this
set palette file ...      # or this

plot [xmin:xmax][ymin:ymax] '++' using 1:2:1 axes x1y2 with image,\
f(x) axes x1y1 notitle w filledcurves below y1=ymax lc rgb "white",\
f(x) axes x1y1 t 'f(x)' w l lc rgb "#000000"

pause -1

plot [xmin:xmax][ymin:ymax] '++' using 1:2:1 axes x1y1 with image,\
f(x) axes x1y2 notitle w filledcurves below y2=ymax lc rgb "white",\
f(x) axes x1y2 t 'f(x)' w l lc rgb "#000000"

I don't think the palette definition is relevant here.

[toc] | [prev] | [next] | [standalone]


#1561

FromIngo Thies <ingo.thies@gmx.de>
Date2012-12-30 11:12 +0100
Message-ID<akaicaFtjnaU1@mid.individual.net>
In reply to#1560
Hi Ethan!

> I believe the problem is that autoscaling (set yrange [0:*])
> cannot be combined with either sampling (plot '++' ...)
> It requires an explicit range over which the samples are generated.

This is also my thought since  recently added a comment to feature 
request #3589786 about a way to get gradient-fill with filledcurves. 
This requires to create the gradient as an image plot (which is then 
partially hidden by the fill above the curve; this results in a gradient 
pattern below the curve).

I tried, as a workaround, to determine the plot limits (which are not 
previously known and vary strongly from datafile to datafile) with a 
preceeding dummy plot to table ("set table") and writeback option. But 
for some reason, writeback & restore doesn't work with tables, so the 
only remaining solution was a dummy plot to the screen which is 
overwritten afterwards. The limits can then be accessed by restore or 
explicitely with GPVAL_Y_MIN and GPVAL_Y_MAX.

So, a good solution would be a fix to writeback&restore with table plots 
to avoid temporary pop-up plots.

Thanks so far,

Ingo

[toc] | [prev] | [next] | [standalone]


#1563

Fromsfeam <sfeam@users.sourceforge.net>
Date2012-12-31 12:09 -0800
Message-ID<kbsrdr$t2n$1@dont-email.me>
In reply to#1561
Ingo Thies wrote:

> Hi Ethan!
> 
>> I believe the problem is that autoscaling (set yrange [0:*])
>> cannot be combined with either sampling (plot '++' ...)
>> It requires an explicit range over which the samples are generated.
> 
> This is also my thought since  recently added a comment to feature
> request #3589786 about a way to get gradient-fill with filledcurves.
> This requires to create the gradient as an image plot (which is then
> partially hidden by the fill above the curve; this results in a gradient
> pattern below the curve).
> 
> I tried, as a workaround, to determine the plot limits (which are not
> previously known and vary strongly from datafile to datafile) with a
> preceeding dummy plot to table ("set table") and writeback option. But
> for some reason, writeback & restore doesn't work with tables, so the
> only remaining solution was a dummy plot to the screen which is
> overwritten afterwards. The limits can then be accessed by restore or
> explicitely with GPVAL_Y_MIN and GPVAL_Y_MAX.

4.6 and 4.7 provide the "stats" command for this purpose.

	Ethan

 
> So, a good solution would be a fix to writeback&restore with table plots
> to avoid temporary pop-up plots.
> 
> Thanks so far,
> 
> Ingo

[toc] | [prev] | [next] | [standalone]


#1565

FromIngo Thies <ingo.thies@gmx.de>
Date2013-01-01 13:36 +0100
Message-ID<akg3isF5rhgU1@mid.individual.net>
In reply to#1563
Am 2012-12-31 21:09, schrieb sfeam:

> 4.6 and 4.7 provide the "stats" command for this purpose.

Thanks, I didn't know this until know.

Wishing a happy new year,

Ingo

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web