Gert Gottschalk
Gert Gottschalk

Reputation: 1716

Gnuplot png file without border line

I want a gnuplot png file to seamlessly blend into the background page color of a website. Setting a background rectangle for the plot with a specific rgb color spec and the same rgbfor the html page works fine.

Colored gnuplot rectangle:

set object 1 rectangle from screen 0,0 to screen 1,1 behind fc rgb "#d0d0e0" lw 0

HTML page background color:

<body text="#000000" bgcolor="#D0D0E0" link="#0000EE" vlink="#551A8B" alink="#FF0000">

Now I would like to get rid of the fine black line around the plot (not the axis, the line around the border) so that it blends into the background perfectly.

I have tried lw 0 as above or setting rectangle styles with noborder or border -1 but none works. I should mention that this is on gnuplot 4.6 patchlevel 0.

You can see the problem on my page here:

http://drgert.dyndns.ws:8000/bmp085/bmp085.php

Thanks for helping, Gert

Upvotes: 3

Views: 4058

Answers (1)

andyras
andyras

Reputation: 15910

Option 1

The simplest option may be to avoid making a background rectangle and instead create a transparent .png:

set term png transparent
set output 'foo.png'
plot x

That way, the image will blend into the page regardless of background color.

Option 2

If you do want the rectangle without a border, then use set style rectangle:

set style rectangle fillstyle noborder

Using this option, you may get a one-pixel white/transparent border at the edge of your .png. To get around this you can make the rectangle bigger than the screen:

set object 1 rectangle from scr -0.1,-0.1 to scr 1.1,1.1 behind fc rgb "#d0d0d0"

Note that this works only with screen coordinates; otherwise the rectangle will be clipped to fit into the plot border.

Upvotes: 5

Related Questions