|
From: Yury <yur...@gm...> - 2024-04-11 05:23:20
|
Hi, Can't test with other versions right now, but with 5.4.3 and 6.0.0 on linux I'm having an issue plotting this: set terminal x11 ; set size square set xrange [-3:3]; set yrange [-3:3]; set samples 7 sigma = 2.0; f(x,y) = (1/(2*pi*sigma**2)) * exp(-(x**2+y**2)/(2*sigma**2)) ; set grid set pm3d map corners2color c1; splot \ f(x,y) \ AFAIU, this should construct radial-symmetric color map with grid lines separating color changes. What it makes instead on my system is a colormap with an arbitrary number of samples for Y axis. I see at least 8 color changes along Y axis, and generally color rectangles are smaller along Y axis, while grid squares are okay. Is this a known or documented behaviour? -Yury |
|
From: Norwid B. <nb...@ya...> - 2024-04-11 09:08:25
|
Hello, not sure if I understood you well, I see two approaches for the task ahead. However in both instances, because it is about the visualization of a grid -- regardless if the visualization retains the 3D perspective, or is a 2D projection / a map -- I would use `isosamples` instead of `samples`. Option i) retains the pm3d map and offers a smoother visual representation by increase of the `isosample` parametre alone ``` set terminal x11; set size square; set xrange [-3:3]; set yrange [-3:3]; set isosamples 100, 100; # number of isosample points along (x,y) sigma = 2.0; f(x,y) = (1/(2*pi*sigma**2)) * exp(-(x**2+y**2)/(2*sigma**2)); set grid; set pm3d map corners2color c1; splot f(x,y); ``` Option ii) presumes you seek a presentation with contour lines, can both afford gnuplot defines the corresponding levels, and the absence of the pm3d map: ``` set terminal x11; set size square; set xrange [-3:3]; set yrange [-3:3]; set isosamples 100; # number of isosample points along x equals the along y sigma = 2.0; f(x,y) = (1/(2*pi*sigma**2)) * exp(-(x**2+y**2)/(2*sigma**2)); set grid; set contour base; unset surface; # no need to display the grid by `isosample` set view map; splot f(x,y); ``` Both approaches were tested with gnuplot 6.0.0 as provided by Linux Debian 13/trixie. Norwid |
|
From: Yury <yur...@gm...> - 2024-04-12 04:13:11
|
Hello Norwid, On 11/04/2024 11:47, Norwid Behrnd via gnuplot-info wrote: > Option i) retains the pm3d map and offers a smoother visual representation by > increase of the `isosample` parametre alone Thank you and everybody for your replies. You gave me an idea how to 'put a plaster on it', at least. I have to use BOTH `samples` and `isosamples`, set to the same value. The following produces just what was intended: ``` set terminal x11 ; set size square. set xrange [-3:4]; set yrange [-3:4]; set samples 8 ; set isosamples 8 sigma = 2.0; f(x,y) = (1/(2*pi*sigma**2)) * exp(-(x*x+y*y)/(2*sigma**2)) ; set grid set pm3d map corners2color c1;. splot f(x,y) ``` However, my question stands. When using my original example (with `samples` only), there's an unexpected (?) asymmetry in the output, which Dr. Lippert confirms. AFAIU there shouldn't be. -Yury |
|
From: Norwid B. <nb...@ya...> - 2024-04-15 10:29:35
|
Hello Yury, in your approach > I have to use BOTH `samples` and `isosamples`, > set to the same value. The following produces > just what was intended: > ``` > set terminal x11 ; > set size square. > set xrange [-3:4]; set yrange [-3:4]; > set samples 8 ; set isosamples 8 > sigma = 2.0; > f(x,y) = (1/(2*pi*sigma**2)) * > exp(-(x*x+y*y)/(2*sigma**2)) ; > set grid > set pm3d map corners2color c1;. > splot f(x,y) > ``` the "tiles" are equidistant along (x,y) and the color levels appear to me symmetric (like an axis C_\infty in molecular symmetry / point groups, perpendicular to the drawing plane) around the central tile with an offset, i.e. its centre is at (0.5,0.5) instead of exactly (0,0) you prefer. I do not know how to shift the array of tiles to account for this. In addition, I notice `set samples 8 ; set isosamples 8` is a rather "lucky combination" as e.g., `set samples 9 ; set isosamples 9` or `set samples 7 ; set isosamples 7` distort the symmetry of this intensity map which can be misleading. Previously, my suggest was to increase the levels of `samples` / `isosamples` to yield an offset no longer significant for the visual analysis of the 3D map. Meanwhile, I read newly released gnuplot 6 provides an automatic `counterfill` with a better visualization of the local extreme around (0,0) in the projection worth to try as an alternative approach: ``` set terminal x11 ; set terminal qt; set size square set xrange [-3:4]; set yrange [-3:4]; set samples 100 ; set isosamples 100 sigma = 2.0; f(x,y) = (1/(2*pi*sigma**2)) * exp(-(x*x+y*y)/(2*sigma**2)) ; set grid set contourfill auto 10 splot f(x,y) with contourfill # set view map; replot # uncomment for the static 2D projection ``` Credit for the inspiration is due to Lee Philips' [Gnuplot 6 comes with pie](https://lwn.net/Articles/961003/) published by February 9, 2024. Norwid |
|
From: Yury <yur...@gm...> - 2024-04-16 06:56:12
|
Hi Norwid, On 15/04/2024 13:29, Norwid Behrnd via gnuplot-info wrote: > the "tiles" are equidistant along (x,y) and the color levels appear to me > symmetric (like an axis C_\infty in molecular symmetry / point groups, > perpendicular to the drawing plane) around the central tile with an offset, > i.e. its centre is at (0.5,0.5) instead of exactly (0,0) you prefer. I do > not know how to shift the array of tiles to account for this. Can't do that in Gnuplot, AFAIU. You get either 4-corners average or one of the corners. You'd have to shift gridlines and labels instead. > notice `set samples 8 ; set isosamples 8` is a rather "lucky combination" as > e.g., `set samples 9 ; set isosamples 9` or `set samples 7 ; set isosamples 7` > distort the symmetry of this intensity map which can be misleading. That combination wasn't 'lucky' in the sense of 'well guessed'. I wanted just what's on screen (now), i.e. coloured-squares visualisation of discrete Gaussian distribution in 2d, centered on (0,0), with squares' centers representing gridlines. Like for representing digital low pass filtering of rasters. The problem is (is it a bug? a feature?) that 'samples' setting if used by itself (without 'isosamples') produces *asymmetrical* picture along X and Y axii, which shouldn't be the case, as whatever value 'isosamples' was set to, it should be (?) used for both axii. Just guessing, looks like a case of non-propagation of generalised values to non-generalised ones in the program source. Thank you for that 'contourfill' snippet, looks interesting. But for my ongoing projects I'll stick with what I know. :) -Yury |