Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

png and dashed

2,302 views
Skip to first unread message

tv

unread,
Jul 21, 2009, 10:07:14 AM7/21/09
to
Is it possible to draw both color and dashed lines with the gd
terminals?
the lt -1 doesn't seem to do it as on the pdf term.

thanks a lot!

Pete Gregory

unread,
Jul 21, 2009, 11:00:03 AM7/21/09
to
try lt 0

Hint. in gnuplot just run the command 'test' to see what the terminal
can do.

Pete.

---
To reply by email without being spam tagged, insert an underscore
between the second and third characters of the 'from' address.

iltommi

unread,
Jul 21, 2009, 1:14:17 PM7/21/09
to
On Jul 21, 5:00 pm, Pete Gregory <pgne...@bushlitt.org> wrote:
> try lt 0
>
> Hint.  in gnuplot just run the command 'test' to see what the terminal
> can do.

ok, using lt 0 gives a gray dashed line.
it didn't work for me because I also added the lw 3
here is a command that doesn't show the dashed line:

set term png enh
set out 'test.png'
plot x w l lt 0 lc rgb "black" lw 3
set out

is it the same for you?
maybe the space between a dash and the other gets filled by the larger
line, is it possible to increase the space between a dash and the
other?

thanks!

sfeam

unread,
Jul 21, 2009, 2:30:01 PM7/21/09
to
iltommi wrote:

> On Jul 21, 5:00 pm, Pete Gregory <pgne...@bushlitt.org> wrote:
>> try lt 0
>>
>> Hint.  in gnuplot just run the command 'test' to see what the terminal
>> can do.
>
> ok, using lt 0 gives a gray dashed line.
> it didn't work for me because I also added the lw 3
> here is a command that doesn't show the dashed line:
>
> set term png enh
> set out 'test.png'
> plot x w l lt 0 lc rgb "black" lw 3
> set out
>
> is it the same for you?

No. As seen here in gnuplot version 4.2.5
lt 0 lc rgb "red" lw 3
produces a red dotted line with linewidth 1
(that is, it keeps the dots and the color but ignores the linewidth).

In the gnuplot cvs version, that same command
produces a thick red solid line. Backing off the thickness to
lt 0 lc rgb "red" lw 2
produces a less thick dotted line. So yes, the spacing between dots
can be filled up by a thick line. The terminal option
set term png ... dashlength N
is supposed to fix this, but it seems to be broken in the CVS version.

Note: It is possible that this behaviour also depends on the version
of libgd.

iltommi

unread,
Jul 22, 2009, 6:53:43 AM7/22/09
to

I've touche at the gd.trm and made it work
at line 1534:
I've replaced
int psize = lw*lw*dashlength;

ssize = lw*lw*(spacelength + dashlength);
with
int psize = lw*dashlength;

ssize = lw*(spacelength + dashlength);

now it does something better, but it is still ugly:

set term png dashlength 0.5
set out 'test.png'
plot x w l lt 0 lw 4 lc rgb "black"
quit

probably some other variable must be adjusted.

Thanks!

iltommi

unread,
Jul 22, 2009, 7:10:32 AM7/22/09
to

very ugly :-)

trying to plot a parabola, it seems that the driver can only plot
horizontal or vertical lines.

set term png dashlength 1
set out 'test.png'
plot x*x w l lt 0 lw 10 lc rgb "black"
quit


sfeam

unread,
Jul 22, 2009, 8:04:56 PM7/22/09
to

> very ugly :-)
>
> trying to plot a parabola, it seems that the driver can only plot
> horizontal or vertical lines.

Unfortunately, that is a limitation of the gd graphics library.
It only draws reasonable dot/dash patternd for horizontal or vertical lines.

That's why gnuplot only provide it for linetype 0, which is normally used
only to draw the horizontal/vertical grid.

Perhaps some future version of libgd will provide a more useful option.
Or you could use the cairo-based png terminal driver instead.

iltommi

unread,
Jul 23, 2009, 3:17:50 AM7/23/09
to
On 23 juil, 02:04, sfeam <sf...@users.sourceforge.net> wrote:
> > very ugly :-)
>
> > trying to plot a parabola, it seems that the driver can only plot
> > horizontal or vertical lines.
>
> Unfortunately, that is a limitation of the gd graphics library.
> It only draws reasonable dot/dash patternd for horizontal or vertical lines.

ok, that explains it!

> Perhaps some future version of libgd will provide a more useful option.
> Or you could use the cairo-based png terminal driver instead.

that'a almost impossible, tha machine I'm running on is quite old and
I don't have access to the system, cairo depends on a bunch of stuff
that it would be a nightmare to recompile everything!
at home I have an osx and (correct me if I'm wrong) it's impossible to
have cairo.

Not such a big problem however.

Thanks again

0 new messages