|
From: Fayer M. <fay...@gm...> - 2010-07-20 10:59:11
|
Expect for canvas size, gnuplot uses relative unit to plot. Now I want to draw directly in unit of pixels. For example, I want something like: set obj rect from 100,20 to 200,30 fc palette cb 3 where 100,20 and 200,30 are in pixel. I set xrange/yrange to something like 1:640 and 1:480, and set all margins to 0. However, the results were still not exactly what I want. And it's a dirty hack. Anyone knows a clean one? I noticed low-level Perl package Term::Gnuplot, but it's not convenient for high-level plotting. Fayer |
|
From: Thomas S. <t.s...@fz...> - 2010-07-20 17:32:30
|
use the screen coordinates when defining objects: set term gif size 640,480 set obj 1 rect from screen 100./640.,20./480. to screen 200./640.,30./480. fc palette cb 3 set out 'plot.gif' plot sin(x) set out Fayer Michael wrote: > > Expect for canvas size, gnuplot uses relative unit to plot. Now I want > to draw directly in unit of pixels. For example, I want something like: > set obj rect from 100,20 to 200,30 fc palette cb 3 > > where 100,20 and 200,30 are in pixel. > > I set xrange/yrange to something like 1:640 and 1:480, and set all > margins to 0. However, the results were still not exactly what I want. > And it's a dirty hack. Anyone knows a clean one? > > I noticed low-level Perl package Term::Gnuplot, but it's not convenient > for high-level plotting. > > Fayer > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > -- View this message in context: http://old.nabble.com/How-to-plot-directly-in-unit-of-pixels-by-gnuplot--tp29213664p29216132.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Fayer M. <fay...@gm...> - 2010-07-21 10:31:00
|
That's exactly what I have tried and failed. What I really want to draw is thousands of thin (big width, small height) rectangles without overlapping but connected (no space between them vertically, but can have space horizontally). They are in different colors and have different width. If I use this kind of relative coordinates (eg. 100/640), the rectangles will overlap vertically a little bit (see code below). That's why I wonder if any methods can use absolute coordinates in pixels to avoid overlapping. The code: set cbrange [0:6] set style rect fs solid noborder set xrange [0:1] set yrange [0:1] set key off unset xtics unset ytics unset colorbox set palette defined (0 "black",1 "yellow") set tmargin 0 set lmargin 0 set bmargin 0 set rmargin 0 set terminal png size 10,10 set output "tt.png" set obj rect from 0,0 to 0.5,0.5 fc palette cb 3 set obj rect from 1,1 to 0.5,0.5 fc palette cb 6 plot -1 lc palette cb 1 # invisible, to show content above replot By using 'eog', one can zoom in the png file up to 2000%, and see two rectangles are overlapped (although mathmetically they should not overlap) and the edges/frames also are not 'tidy'. > Date: Tue, 20 Jul 2010 10:32:23 -0700 (PDT) > From: Thomas Sefzick <t.s...@fz...> > Subject: Re: [Gnuplot-info] How to plot directly in unit of pixels by > gnuplot? > To: gnu...@li... > Message-ID: <292...@ta...> > Content-Type: text/plain; charset=us-ascii > > > use the screen coordinates when defining objects: > > set term gif size 640,480 > set obj 1 rect from screen 100./640.,20./480. to screen 200./640.,30./480. > fc palette cb 3 > set out 'plot.gif' > plot sin(x) > set out > > > Fayer Michael wrote: > > > > Except for canvas size, gnuplot uses relative unit to plot. Now I want > > to draw directly in unit of pixels. For example, I want something like: > > set obj rect from 100,20 to 200,30 fc palette cb 3 > > > > where 100,20 and 200,30 are in pixel. > > > > I set xrange/yrange to something like 1:640 and 1:480, and set all > > margins to 0. However, the results were still not exactly what I want. > > And it's a dirty hack. Anyone knows a clean one? > > > > I noticed low-level Perl package Term::Gnuplot, but it's not convenient > > for high-level plotting. > > > > Fayer |
|
From: Thomas S. <t.s...@fz...> - 2010-07-21 12:08:08
|
did you deactivate the 'Smooth images when zoomed' feature in 'eog'? Fayer Michael wrote: > > That's exactly what I have tried and failed. What I really want to draw > is thousands of thin (big width, small height) rectangles without > overlapping but connected (no space between them vertically, but can > have space horizontally). They are in different colors and have > different width. If I use this kind of relative coordinates (eg. > 100/640), the rectangles will overlap vertically a little bit (see code > below). That's why I wonder if any methods can use absolute coordinates > in pixels to avoid overlapping. > > The code: > > set cbrange [0:6] > set style rect fs solid noborder > set xrange [0:1] > set yrange [0:1] > set key off > unset xtics > unset ytics > unset colorbox > set palette defined (0 "black",1 "yellow") > set tmargin 0 > set lmargin 0 > set bmargin 0 > set rmargin 0 > set terminal png size 10,10 > set output "tt.png" > set obj rect from 0,0 to 0.5,0.5 fc palette cb 3 > set obj rect from 1,1 to 0.5,0.5 fc palette cb 6 > plot -1 lc palette cb 1 # invisible, to show content above > replot > > By using 'eog', one can zoom in the png file up to 2000%, and see two > rectangles are overlapped (although mathmetically they should not > overlap) and the edges/frames also are not 'tidy'. > >> Date: Tue, 20 Jul 2010 10:32:23 -0700 (PDT) >> From: Thomas Sefzick <t.s...@fz...> >> Subject: Re: [Gnuplot-info] How to plot directly in unit of pixels by >> gnuplot? >> To: gnu...@li... >> Message-ID: <292...@ta...> >> Content-Type: text/plain; charset=us-ascii >> >> >> use the screen coordinates when defining objects: >> >> set term gif size 640,480 >> set obj 1 rect from screen 100./640.,20./480. to screen >> 200./640.,30./480. >> fc palette cb 3 >> set out 'plot.gif' >> plot sin(x) >> set out >> >> >> Fayer Michael wrote: >> > >> > Except for canvas size, gnuplot uses relative unit to plot. Now I want >> > to draw directly in unit of pixels. For example, I want something like: >> > set obj rect from 100,20 to 200,30 fc palette cb 3 >> > >> > where 100,20 and 200,30 are in pixel. >> > >> > I set xrange/yrange to something like 1:640 and 1:480, and set all >> > margins to 0. However, the results were still not exactly what I want. >> > And it's a dirty hack. Anyone knows a clean one? >> > >> > I noticed low-level Perl package Term::Gnuplot, but it's not convenient >> > for high-level plotting. >> > >> > Fayer > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > -- View this message in context: http://old.nabble.com/How-to-plot-directly-in-unit-of-pixels-by-gnuplot--tp29213664p29224909.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |