Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #3584 > unrolled thread
| Started by | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| First post | 2017-03-20 08:36 +0100 |
| Last post | 2017-04-05 22:09 -0700 |
| Articles | 12 — 3 participants |
Back to article view | Back to comp.graphics.apps.gnuplot
set range for second independent variable in special file '++' Karl Ratzsch <mail.kfr@gmx.net> - 2017-03-20 08:36 +0100
Re: set range for second independent variable in special file '++' Ethan A Merritt <EAMerritt@gmail.com> - 2017-03-20 09:39 -0700
Re: set range for second independent variable in special file '++' Karl Ratzsch <mail.kfr@gmx.net> - 2017-03-20 18:56 +0100
Re: set range for second independent variable in special file '++' Ethan A Merritt <sfeam@users.sourceforge.net> - 2017-03-20 12:36 -0700
Re: set range for second independent variable in special file '++' Ethan A Merritt <sfeam@users.sourceforge.net> - 2017-03-20 12:38 -0700
Re: set range for second independent variable in special file '++' Karl Ratzsch <mail.kfr@gmx.net> - 2017-03-24 13:15 +0100
Re: set range for second independent variable in special file '++' Ethan A Merritt <EAMerritt@gmail.com> - 2017-03-26 12:30 -0700
Re: set range for second independent variable in special file '++' Karl Ratzsch <mail.kfr@gmx.net> - 2017-03-27 03:35 +0200
Re: set range for second independent variable in special file '++' Ethan A Merritt <EAMerritt@gmail.com> - 2017-03-26 23:00 -0700
Re: set range for second independent variable in special file '++' Karl Ratzsch <mail.kfr@gmx.net> - 2017-03-27 22:15 +0200
Re: set range for second independent variable in special file '++' Karl Ratzsch <mail.kfr@gmx.net> - 2017-04-02 19:02 +0200
Re: set range for second independent variable in special file '++' Ethan A Merritt <EAMerritt@gmail.com> - 2017-04-05 22:09 -0700
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2017-03-20 08:36 +0100 |
| Subject | set range for second independent variable in special file '++' |
| Message-ID | <oao0pn$80p$1@solani.org> |
Hi, this is an example from the help: splot [-2:2][-2:2] sample [h=1:10] '+' using (cos(h)):(sin(h)):(h) Simple enough. This gives an error, however splot sample [h=-9:9] [d=-0.2:0.2] '++' using (cos(h)):(sin(h)):(h+d) . Can i set the range for the second independent variable of "++" and still set the x,y display range independently? I managed to do it plotting the numbers to a table, and then plotting that with different (auto)ranging: set xr [-9:9] set yr [-0.2:0.2] set table $dat splot '++' using (cos(h)):(sin(h)):(h+d) unset table reset splot $dat w l but I think I'm missing something. ? Karl
[toc] | [next] | [standalone]
| From | Ethan A Merritt <EAMerritt@gmail.com> |
|---|---|
| Date | 2017-03-20 09:39 -0700 |
| Message-ID | <oap0et$g16$1@dont-email.me> |
| In reply to | #3584 |
Karl Ratzsch wrote: > Hi, > > this is an example from the help: > > splot [-2:2][-2:2] sample [h=1:10] '+' using (cos(h)):(sin(h)):(h) This generates a parametric line in 3D space > > Simple enough. This gives an error, however > > splot sample [h=-9:9] [d=-0.2:0.2] '++' using > (cos(h)):(sin(h)):(h+d) What is this supposed to describe? Isolated points? A set of lines? A surface? A set of surfaces? > . Can i set the range for the second independent variable of "++" and > still set the x,y display range independently? > > I managed to do it plotting the numbers to a table, and then plotting > that with different (auto)ranging: > > set xr [-9:9] > set yr [-0.2:0.2] > set table $dat > splot '++' using (cos(h)):(sin(h)):(h+d) > unset table Those commands as shown do not work. There must be some other stuff you don't show. I still a can't figure out what you are aiming for here, so I can't offer a suggestion how else to get there. Ethan > reset > splot $dat w l > > but I think I'm missing something. ? > > Karl
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2017-03-20 18:56 +0100 |
| Message-ID | <oap546$3i0$1@solani.org> |
| In reply to | #3585 |
Am 20.03.2017 um 17:39 schrieb Ethan A Merritt: > Karl Ratzsch wrote: >> . Can i set the range for the second independent variable of "++" and >> still set the x,y display range independently? >> >> I managed to do it plotting the numbers to a table, and then plotting >> that with different (auto)ranging: > > Those commands as shown do not work. > There must be some other stuff you don't show. > I still a can't figure out what you are aiming for here, > so I can't offer a suggestion how else to get there. (Sorry for the copypasted nonsense.) set xr [-9:9] ; set yr [-1:1] set table $dat splot '++' using (cos($1)):(sin($1)):($1+$2) w l unset table reset splot $dat w l I want to plot a ribbon wound on a cylindrical core (not actually such a boring one, but nevermind). It seems I can only specify one independent variable with range for '++'. Is that so?
[toc] | [prev] | [next] | [standalone]
| From | Ethan A Merritt <sfeam@users.sourceforge.net> |
|---|---|
| Date | 2017-03-20 12:36 -0700 |
| Message-ID | <oapapn$po7$1@dont-email.me> |
| In reply to | #3586 |
Karl Ratzsch wrote:
> Am 20.03.2017 um 17:39 schrieb Ethan A Merritt:
>> Karl Ratzsch wrote:
>>> . Can i set the range for the second independent variable of "++" and
>>> still set the x,y display range independently?
>>>
>>> I managed to do it plotting the numbers to a table, and then plotting
>>> that with different (auto)ranging:
>>
>> Those commands as shown do not work.
>> There must be some other stuff you don't show.
>> I still a can't figure out what you are aiming for here,
>> so I can't offer a suggestion how else to get there.
>
> (Sorry for the copypasted nonsense.)
>
> set xr [-9:9] ; set yr [-1:1]
> set table $dat
> splot '++' using (cos($1)):(sin($1)):($1+$2) w l
> unset table
>
> reset
> splot $dat w l
>
> It seems I can only specify one independent variable with range for
> '++'. Is that so?
Yes, but...
That's mostly because it's not clear how one could use it.
If you have an example of a type of plot that this would allow,
I'd be happy to look into adding it.
> I want to plot a ribbon wound on a cylindrical core (not actually such a
> boring one, but nevermind).
Hmm. The way I know of is this:
set xrange [-1:1]
set yrange [-1:1]
rise = 3.
radius = 0.5
set parametric
splot radius*sin(u), radius*cos(u), (rise*u-v)
Are you thinking that this would be easier if u/x and v/y were decoupled?
What would your new set of commands look like?
Ethan
[toc] | [prev] | [next] | [standalone]
| From | Ethan A Merritt <sfeam@users.sourceforge.net> |
|---|---|
| Date | 2017-03-20 12:38 -0700 |
| Message-ID | <oapaur$q4d$1@dont-email.me> |
| In reply to | #3587 |
Ethan A Merritt wrote: > Karl Ratzsch wrote: > >> Am 20.03.2017 um 17:39 schrieb Ethan A Merritt: >>> Karl Ratzsch wrote: >>>> . Can i set the range for the second independent variable of "++" and >>>> still set the x,y display range independently? >>>> >>>> I managed to do it plotting the numbers to a table, and then plotting >>>> that with different (auto)ranging: >>> >>> Those commands as shown do not work. >>> There must be some other stuff you don't show. >>> I still a can't figure out what you are aiming for here, >>> so I can't offer a suggestion how else to get there. >> >> (Sorry for the copypasted nonsense.) >> >> set xr [-9:9] ; set yr [-1:1] >> set table $dat >> splot '++' using (cos($1)):(sin($1)):($1+$2) w l >> unset table >> >> reset >> splot $dat w l >> >> It seems I can only specify one independent variable with range for >> '++'. Is that so? > > Yes, but... > That's mostly because it's not clear how one could use it. > If you have an example of a type of plot that this would allow, > I'd be happy to look into adding it. > >> I want to plot a ribbon wound on a cylindrical core (not actually such a >> boring one, but nevermind). > > Hmm. The way I know of is this: > > set xrange [-1:1] > set yrange [-1:1] > rise = 3. > radius = 0.5 > set parametric > splot radius*sin(u), radius*cos(u), (rise*u-v) Bonus points for style: set isosample 100, 10 set hidden3d replot
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2017-03-24 13:15 +0100 |
| Message-ID | <ob32kh$usr$1@solani.org> |
| In reply to | #3588 |
Am 20.03.2017 um 20:38 schrieb Ethan A Merritt: > Ethan A Merritt wrote: >> Karl Ratzsch wrote: >>> It seems I can only specify one independent variable with range for >>> '++'. Is that so? >> >> Yes, but... >> That's mostly because it's not clear how one could use it. >> If you have an example of a type of plot that this would allow, >> I'd be happy to look into adding it. Hm, there are many, i think. The special filename "++" at the moment always directly maps the second independent variable to the y axis, but it could easily be meant to be sth else. Of course one can scale the values to the wanted sampling range in the "using" specifier, but you need a number of additional variables and it makes the script hard to read. Any kind of circular object would be an example, or generally a 3D plot with a coordinate transformation. Parametric mode is an alternative, but I think I'm not the only one who tries to avoid it because of the ugly syntax. ;-) >>> I want to plot a ribbon wound on a cylindrical core (not actually such a >>> boring one, but nevermind). >> set parametric >> splot radius*sin(u), radius*cos(u), (rise*u-v) >> set isosample 100, 10 > set hidden3d > replot Here's the actual plot I wanted to make, now using parametric mode. It's a short electric coil with a large volume of constant magnetic flux density. a=-0.012 # zero for even coil width n=9. # windings l=20.;r=8. # lenght and radius d=0.5 # distance between windings #PRIVALOV, DVINSKIKH, VIETH, 1996, JMagRes A, 123, 157-160 k(n,a) = l/2 / (pi*n + a*pi**2*n**2) # normalise height to l s(th,a) = k(n,a) * (th + a*th*abs(th)) # conductor center h1(th,a) = (s(th+2*pi,a) + s(th,a))/2 - d/2 # edge 1 h2(th,a) = (s(th-2*pi,a) + s(th,a))/2 + d/2 # edge 2 set param set xr[-r:r]; set yr[-r:r] set urange [-n*pi:n*pi] set vrange [0:1] set isosample 1000,8 set hidden3d set view equal xyz set xyplane 0 splot r*cos(u),r*sin(u),h1(u,a)*v/2 + h2(u,a)*(1-v)/2
[toc] | [prev] | [next] | [standalone]
| From | Ethan A Merritt <EAMerritt@gmail.com> |
|---|---|
| Date | 2017-03-26 12:30 -0700 |
| Message-ID | <ob94nq$vrh$1@dont-email.me> |
| In reply to | #3593 |
Karl Ratzsch wrote: > Am 20.03.2017 um 20:38 schrieb Ethan A Merritt: >> Ethan A Merritt wrote: >>> Karl Ratzsch wrote: >>>> It seems I can only specify one independent variable with range for >>>> '++'. Is that so? >>> >>> Yes, but... >>> That's mostly because it's not clear how one could use it. >>> If you have an example of a type of plot that this would allow, >>> I'd be happy to look into adding it. > > Hm, there are many, i think. The special filename "++" at the moment > always directly maps the second independent variable to the y axis, > but it could easily be meant to be sth else. Of course one can scale > the values to the wanted sampling range in the "using" specifier, but > you need a number of additional variables and it makes the script hard > to read. That much is a trivial change and I agree it is an improvement. So as of today's CVS for the development version, '++' uses urange and vrange for sampling rather than using xrange and yrange. This does not by itself allow you to refer to the sampled variables as "u" and "v" however, you'll still have to refer to $1 and $2. I know of one minor downside to this change. Currently you can't set u or v to log-scale, so with this change you won't get nonlinear sampling on '++' even after "set log xy". That can be added later. Ethan
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2017-03-27 03:35 +0200 |
| Message-ID | <ob9q9a$jc4$1@solani.org> |
| In reply to | #3596 |
Am 26.03.2017 um 21:30 schrieb Ethan A Merritt: > Karl Ratzsch wrote: >> Hm, there are many, i think. The special filename "++" at the moment >> always directly maps the second independent variable to the y axis, >> but it could easily be meant to be sth else. Of course one can scale >> the values to the wanted sampling range in the "using" specifier, but >> you need a number of additional variables and it makes the script hard >> to read. > > That much is a trivial change and I agree it is an improvement. > > So as of today's CVS for the development version, '++' uses urange and > vrange for sampling rather than using xrange and yrange. > This does not by itself allow you to refer to the sampled variables > as "u" and "v" however, you'll still have to refer to $1 and $2. > > I know of one minor downside to this change. > Currently you can't set u or v to log-scale, so with this change > you won't get nonlinear sampling on '++' even after "set log xy". > That can be added later. Not much of a downside, but what about "+" ? Will it use trange now? That's a bit strong, re backwards compatibility. ?
[toc] | [prev] | [next] | [standalone]
| From | Ethan A Merritt <EAMerritt@gmail.com> |
|---|---|
| Date | 2017-03-26 23:00 -0700 |
| Message-ID | <oba9kq$ppi$1@dont-email.me> |
| In reply to | #3597 |
Karl Ratzsch wrote:
> Am 26.03.2017 um 21:30 schrieb Ethan A Merritt:
>> Karl Ratzsch wrote:
>>> Hm, there are many, i think. The special filename "++" at the moment
>>> always directly maps the second independent variable to the y axis,
>>> but it could easily be meant to be sth else. Of course one can scale
>>> the values to the wanted sampling range in the "using" specifier,
>>> but you need a number of additional variables and it makes the
>>> script hard to read.
>>
>> That much is a trivial change and I agree it is an improvement.
>>
>> So as of today's CVS for the development version, '++' uses urange
>> and vrange for sampling rather than using xrange and yrange.
>> This does not by itself allow you to refer to the sampled variables
>> as "u" and "v" however, you'll still have to refer to $1 and $2.
>>
>> I know of one minor downside to this change.
>> Currently you can't set u or v to log-scale, so with this change
>> you won't get nonlinear sampling on '++' even after "set log xy".
>> That can be added later.
>
> Not much of a downside, but what about "+" ? Will it use trange now?
> That's a bit strong, re backwards compatibility. ?
Good question.
Although the syntax required is not quite the same as for '++'
you can already effectively do that like this:
set xrange [1:100]
plot sample [t=10:20] '+' using (t):(sin(t))
You are right that it could default to using trange rather than xrange
if trange has been set previously.
Backwards compatibility would be a concern, but ... [thinking as I type]
trange isn't set by default since at the moment it is ignored unless
you are in polar or parametric mode. So the conflict with older
syntax is less than it might be. I don't know whether or not it's a
good idea since it doesn't actually gain you anything you can't do
already (unlike the '++' case).
Let's defer that idea for now. There are some autoscaling problems lurking
around the use of t/u/v for sampling, particularly for log scale x or y.
I want to sort those out first.
Ethan
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2017-03-27 22:15 +0200 |
| Message-ID | <obbrte$tvn$1@solani.org> |
| In reply to | #3598 |
Am 27.03.2017 um 08:00 schrieb Ethan A Merritt: > Karl Ratzsch wrote: >> Not much of a downside, but what about "+" ? Will it use trange now? >> That's a bit strong, re backwards compatibility. ? > > Good question. > > Although the syntax required is not quite the same as for '++' > you can already effectively do that like this: > > set xrange [1:100] > plot sample [t=10:20] '+' using (t):(sin(t)) Ja, that's definitely sufficient, and probably better than reusing the parametric 't' variable outside of it's original scope. For "++", this plot sample [var1=10:20] [var2=-3:3] '++' using ... would be my favourite (nice not having to use the cryptic $n's, ranges can be varied for subplots), but it's probably heck to get the parser to recognise it. One "sample" keyword demands for one following range specifer, a second one might not be so easy to catch. ?
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2017-04-02 19:02 +0200 |
| Message-ID | <obrare$eh7$1@solani.org> |
| In reply to | #3599 |
Am 27.03.2017 um 22:15 schrieb Karl Ratzsch: > > Ja, that's definitely sufficient, and probably better than reusing the > parametric 't' variable outside of it's original scope. For "++", this > > plot sample [var1=10:20] [var2=-3:3] '++' using ... > > would be my favourite (nice not having to use the cryptic $n's, ranges > can be varied for subplots), but it's probably heck to get the parser to > recognise it. One "sample" keyword demands for one following range > specifer, a second one might not be so easy to catch. ? > Saw the latest 5.1 changelog earlier and gave it a quick try, thanks! Any special reason it only works with "splot", not with "plot"? Not that I presently have a 2D plot in mind that would make sensible use of that feature, but who knows ... ;-) Karl
[toc] | [prev] | [next] | [standalone]
| From | Ethan A Merritt <EAMerritt@gmail.com> |
|---|---|
| Date | 2017-04-05 22:09 -0700 |
| Message-ID | <oc4ic1$iki$1@dont-email.me> |
| In reply to | #3608 |
Karl Ratzsch wrote: > Am 27.03.2017 um 22:15 schrieb Karl Ratzsch: >> >> Ja, that's definitely sufficient, and probably better than reusing >> the parametric 't' variable outside of it's original scope. For "++", >> this >> >> plot sample [var1=10:20] [var2=-3:3] '++' using ... >> >> would be my favourite (nice not having to use the cryptic $n's, >> ranges can be varied for subplots), but it's probably heck to get the >> parser to recognise it. One "sample" keyword demands for one >> following range specifer, a second one might not be so easy to catch. >> ? >> > > Saw the latest 5.1 changelog earlier and gave it a quick try, thanks! > > Any special reason it only works with "splot", not with "plot"? Both plot and splot use the same code to parse the input, so it should either work or not work for both of them. What did you try that didn't work? Ethan > Not > that I presently have a 2D plot in mind that would make sensible use > of that > feature, but who knows ... ;-) > > Karl
[toc] | [prev] | [standalone]
Back to top | Article view | comp.graphics.apps.gnuplot
csiph-web