|
From: Fayer M. <fay...@gm...> - 2010-08-04 16:18:06
|
I have found the answer. This mail is just for anyone who has same
problem.
Gnuplot may not be a good choice for abstract coordinate plotting. For
such purpose, ImageMagick is a perfect choice. Of course, ImageMagick is
a far more useful tool.
To draw two stacked but non-overlapped rectanges, if one use PerlMagick,
a simple but fully functional sample code can be as below:
use Image::Magick;
my $o=Image::Magick->new;
$o->Set(size=>'10x10');
$o->Read('xc:transparent'); # canvas color
$o->Draw(primitive=>'rectangle',points=>'6,6
9,9',fill=>'hsb(16.6667%,100%,100%)'); # yellow
$o->Draw(primitive=>'rectangle',points=>'3,3
7,5',fill=>'hsb(16.6667%,100%,60%)'); # dark yellow
$o->Write('test.gif');
Fayer
On Tue, 2010-07-27 at 08:49 +0800, Fayer Michael wrote:
> Anyone has further comments on this issue?
>
> BTW, I have found 'No digest' will get emails separately without
> missing.
>
> Fayer
>
>
> > Date: Sat, 24 Jul 2010 07:34:47 +0800
> > From: "Fayer Michael" <fay...@em...>
> > Subject: Re: [Gnuplot-info] How to plot directly in unit of pixels by
> > gnuplot?
> > To: <gnu...@li...>
> > Message-ID: <A8C2676799324C6583B740607AC48323@arara>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > Yes, I have to, because I want to see pixels clearly.
> >
> > I found 'digest' in the mailing list is slow. Maybe I shouldn't use this feature? I worry if I choose 'no' in 'Would you like to receive list mail batched in a daily digest', I will get nothing any more. I'm a newbie. Sorry for such questions.
> >
> > Fayer
> >
> > > Date: Wed, 21 Jul 2010 05:08:01 -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
> > >
> > >
> > > 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
|