Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #3995 > unrolled thread
| Started by | nawridlz@gmail.com |
|---|---|
| First post | 2018-07-11 00:02 -0700 |
| Last post | 2018-07-13 09:53 +0200 |
| Articles | 9 — 2 participants |
Back to article view | Back to comp.graphics.apps.gnuplot
Samples, isosamples, and how they affect contour lines nawridlz@gmail.com - 2018-07-11 00:02 -0700
Re: Samples, isosamples, and how they affect contour lines Karl Ratzsch <mail.kfr@gmx.net> - 2018-07-11 11:26 +0200
Re: Samples, isosamples, and how they affect contour lines nawridlz@gmail.com - 2018-07-11 22:39 -0700
Re: Samples, isosamples, and how they affect contour lines Karl Ratzsch <mail.kfr@gmx.net> - 2018-07-12 08:08 +0200
Re: Samples, isosamples, and how they affect contour lines nawridlz@gmail.com - 2018-07-11 23:50 -0700
Re: Samples, isosamples, and how they affect contour lines Karl Ratzsch <mail.kfr@gmx.net> - 2018-07-12 17:18 +0200
Re: Samples, isosamples, and how they affect contour lines nawridlz@gmail.com - 2018-07-13 00:22 -0700
Re: Samples, isosamples, and how they affect contour lines Karl Ratzsch <mail.kfr@gmx.net> - 2018-07-13 12:39 +0200
Re: Samples, isosamples, and how they affect contour lines Karl Ratzsch <mail.kfr@gmx.net> - 2018-07-13 09:53 +0200
| From | nawridlz@gmail.com |
|---|---|
| Date | 2018-07-11 00:02 -0700 |
| Subject | Samples, isosamples, and how they affect contour lines |
| Message-ID | <884eb2ab-a118-41a9-aaa1-bfcdd71f0d0e@googlegroups.com> |
Contour lines generated by gnuplot can look pretty strange (unexpected) if you do not set both `samples` and `isosamples` to appropriate values. I struggled for hours to find out how exactly `set samples` and `set isosamples` affect the appearance of contour lines, however, all I observed is that setting both to sufficiently large values will generate good-looking contours. Still, I want to understand how exactly this works.
1. What is the difference between `set samples` and `set isosamples` in the context of contour lines?
2. How does `set samples` affect the generation of contour lines?
3. How does `set isosamples` affect the generation of contour lines?
For example, consider the following simple case:
unset surface
set contour
set cntrparam levels discrete 10, 20
set samples 250, 2
set isosamples 2, 250
set view map
splot x**2 + y**2
To generate correct contour lines, it appears you need to set the first parameter of `samples` and the second parameter of `isosamples` to sufficiently large values. However, setting the second parameter of `samples` and the first parameter of `isosamples` to the smallest possible value does no harm. This is not exactly intuitive. So how does this work?
I note that I asked this question before on Stack Overflow, but got no answers.
[toc] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2018-07-11 11:26 +0200 |
| Message-ID | <pi4igh$v3p$1@solani.org> |
| In reply to | #3995 |
Am 11.07.2018 um 09:02 schrieb nawridlz@gmail.com: > Contour lines generated by gnuplot can look pretty strange (unexpected) if you do not set both `samples` and `isosamples` to appropriate values. I struggled for hours to find out how exactly `set samples` and `set isosamples` affect the appearance of contour lines, however, all I observed is that setting both to sufficiently large values will generate good-looking contours.. Still, I want to understand how exactly this works. > > 1. What is the difference between `set samples` and `set isosamples` in the context of contour lines? > 2. How does `set samples` affect the generation of contour lines? > 3. How does `set isosamples` affect the generation of contour lines? > > For example, consider the following simple case: > > unset surface > set contour > set cntrparam levels discrete 10, 20 > set samples 250, 2 > set isosamples 2, 250 > set view map > splot x**2 + y**2 > > To generate correct contour lines, it appears you need to set the first parameter of `samples` and the second parameter of `isosamples` to sufficiently large values. However, setting the second parameter of `samples` and the first parameter of `isosamples` to the smallest possible value does no harm.. This is not exactly intuitive. So how does this work? > > I note that I asked this question before on Stack Overflow, but got no answers. > I think you are confused between the generation of xy values and the contour generation. You should generate a dataset with a fixed sampling, and then look how "set sample" influences the look of contours. set samp 40 set isos 40 set table $dat splot x**2+y**2 unset table set view map splot $dat title "an evenly spaced grid of datapoints" reset Now if you try to plot contours on this dataset, you will find that the sampling settings just have no influence on the contour appearance. The contour points are generated from the grid. hth, Karl
[toc] | [prev] | [next] | [standalone]
| From | nawridlz@gmail.com |
|---|---|
| Date | 2018-07-11 22:39 -0700 |
| Message-ID | <31e8c304-ae02-4814-b3f3-48c06a77dded@googlegroups.com> |
| In reply to | #3997 |
I'm sorry, I still have no idea what's going on here. Consider the following example:
set samples 6
set isosamples 500
set table $surface
splot x ** 2 + y ** 2
unset table
set contour
set cntrparam levels discrete 80
set view map
splot $surface
1. Why is there a smooth curve in the interval [-10, -6]?
2. Why is there a straight line in the interval [-6, -2]?
3. Why are there no points at all in the interval [-2, 2]?
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2018-07-12 08:08 +0200 |
| Message-ID | <pi6r9e$cjn$1@solani.org> |
| In reply to | #4004 |
Am 12.07.2018 um 07:39 schrieb nawridlz@gmail.com: > I'm sorry, I still have no idea what's going on here. Consider the following example: > > set samples 6 > set isosamples 500 > set table $surface > splot x ** 2 + y ** 2 > unset table > set contour > set cntrparam levels discrete 80 > set view map > splot $surface > > 1. Why is there a smooth curve in the interval [-10, -6]? > 2. Why is there a straight line in the interval [-6, -2]? > 3. Why are there no points at all in the interval [-2, 2]? > gnuplot takes the grid values in x-direction, and adds an interpolated contour point wherever the connection between these two points crosses the y-grid. (afterwards it does the same in the other direction, and sorts the interpolated points into a closed contour line) The 2 lines between -2 and 2 are horizontal, so they don't cross the y-grid at all. I mean, you cannot expect a nice-looking contour on a data grid that only has six values in one direction, right? You need a grid with similar density in BOTH directions.
[toc] | [prev] | [next] | [standalone]
| From | nawridlz@gmail.com |
|---|---|
| Date | 2018-07-11 23:50 -0700 |
| Message-ID | <5187f490-08b0-4d98-acea-61f0ff158f3f@googlegroups.com> |
| In reply to | #4005 |
By y-grid you mean the plane z = 80?
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2018-07-12 17:18 +0200 |
| Message-ID | <pi7rfv$22d$1@solani.org> |
| In reply to | #4006 |
Am 12.07.2018 um 08:50 schrieb nawridlz@gmail.com:
> By y-grid you mean the plane z = 80?
>
no, the sampling distance between points in direction y.
set sample 6
set isosample 500
gives a grid with 6 points in direction x, times 500 in direction y.
That's the grid you see with
set view map
splot $surface
How should the contour routine know what the z values at x=0 are when
there is nothing to interpolate between?
Actually your contour is terrible between [-10:-6] and [6:10] too. It
looks nice and round, but is a very sketchy interpolation, much worse
even in [-6:-2] and [2:6]
reset
set samp 100
set isos 100
set table $surf200 # this is a well-gridded plot
splot x**2+y**2
set samp 6
set isos 500
set table $surface # this isn't
rep
unset table
set view map
set cntrparam levels discrete 20, 40, 60, 80
set contour
unset surface # comment out to see the grid
splot $surf200 w l title "200x200 grid", \
$surface w p ps .5 pt 1 title "6x500 grid"
[toc] | [prev] | [next] | [standalone]
| From | nawridlz@gmail.com |
|---|---|
| Date | 2018-07-13 00:22 -0700 |
| Message-ID | <62c2956e-101c-4c7d-8fc1-313f5670c3b5@googlegroups.com> |
| In reply to | #4007 |
Can we go through a simple example? Consider once again the following case:
set samples 6
set isosamples 21
set table $surface
splot x ** 2 + y ** 2
unset table
set contour
set cntrparam levels discrete 80
set view map
splot $surface
Now, you wrote:
> gnuplot takes the grid values in x-direction, and adds an interpolated
> contour point wherever the connection between these two points crosses
> the y-grid.
If I understand correctly, we consider two grid points consecutive in x-direction, for example (-6, -8) and (-2, -8). Now, we add a contour point between them, according to the plot at (-3.5, -8). Why exactly at (-3.5, -8)? What do you mean by crossing the y-grid?
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2018-07-13 12:39 +0200 |
| Message-ID | <pi9vho$bpp$1@solani.org> |
| In reply to | #4009 |
Am 13.07.2018 um 09:22 schrieb nawridlz@gmail.com: > Can we go through a simple example? Consider once again the following case: > > set samples 6 > set isosamples 21 > set table $surface > splot x ** 2 + y ** 2 > unset table > set contour > set cntrparam levels discrete 80 > set view map > splot $surface > > Now, you wrote: > >> gnuplot takes the grid values in x-direction, and adds an interpolated >> contour point wherever the connection between these two points crosses >> the y-grid. > If I understand correctly, we consider two grid points consecutive in x-direction, for example (-6, -8) and (-2, -8). Now, we add a contour point between them, according to the plot at (-3.5, -8). Why exactly at (-3.5, -8)? That is where a line parallel to the x-axis at y=-8 and z=80 goes through that the badly sampled surface of z = x^2 + y2. At least that is how I understand the contour generation algorithm.
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2018-07-13 09:53 +0200 |
| Message-ID | <pi9lov$54v$1@solani.org> |
| In reply to | #3995 |
Am 11.07.2018 um 09:02 schrieb nawridlz@gmail.com: > set samples 250, 2 > set isosamples 2, 250 > set view map > splot x**2 + y**2 > To generate correct contour lines, it appears you need to set the first parameter of `samples` and the second parameter of `isosamples` to sufficiently large values. However, setting the second parameter of `samples` and the first parameter of `isosamples` to the smallest possible value does no harm.. This is not exactly intuitive. So how does this work? Has nothing to do with contours. "set sample x, y" specifies how many points are generated on each isoline in the respective direction. "set isosamp x, y" specifies the number of isolines. set sample 100,40 set isos 10,4 set view map; splot 1 w p makes four isolines with 100 points in direction x, and 10 isolines with 40 points each in direction y. To not get isolines, but just an even grid, you give the same parameters to set sample and isosample set sample 50,20 set isosample 50,20 Actually you can always set one of the isosample parameters to "2", to get an even grid, you only need the isolines in one direction. And you can set the sample number in the other direction to "2" also, because the needed points are already generated by the isolines in the first direction. set sample 50,2 # this also makes an even 50:20 matrix set isosample 2,20
[toc] | [prev] | [standalone]
Back to top | Article view | comp.graphics.apps.gnuplot
csiph-web