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

Boxes with both black pattern and background color

609 views
Skip to first unread message

Maxiwell Garcia

unread,
Dec 13, 2012, 4:01:59 PM12/13/12
to
Hi,

I am using the boxes to make histograms, and I use:
"w boxes ls 1 fs pattern 7". But the background color in the box is white and I dont know how to put color there. I would the pattern with black color, and the background with gray color. I tried:
"w boxes ls 1 fs solid 0.5 fs pattern 7" but the backgrund color is still white.

This trick it's possible?

gnuplot 4.6
set terminal pdf


sfeam

unread,
Dec 13, 2012, 4:43:42 PM12/13/12
to
"fs transparent pattern 7" will allow the background color to show through,
which may or may not be white.

I suppose you could plot the boxes twice - the first time with solid fill
of the desired color and the second time with a transparent pattern.

Maxiwell Garcia

unread,
Dec 13, 2012, 5:57:26 PM12/13/12
to sf...@users.sourceforge.net
The problem in this approach is the keys. Each plot generates one. Or only the pattern or only the color appears in the key. Am I missing something?

sfeam

unread,
Dec 13, 2012, 6:33:44 PM12/13/12
to
Use "notitle" to suppress one or the other.
But yes, the key would only have the solid color or the pattern but not both.


Thomas Wagner

unread,
Dec 15, 2012, 9:00:39 AM12/15/12
to
Am 14.12.2012 00:33, schrieb sfeam:
>>> I suppose you could plot the boxes twice - the first time with solid fill
>>>
>>> of the desired color and the second time with a transparent pattern.
>>>
>>>
>>
>> The problem in this approach is the keys. Each plot generates one. Or only
>> the pattern or only the color appears in the key. Am I missing something?
>
>
> Use "notitle" to suppress one or the other.
> But yes, the key would only have the solid color or the pattern but not both.
>
>
Use multiplot to draw both plots in such a way that the second one
perfectly overlays the first one. Use boxes filled with a solid color
with the first plot and choose boxes filled with a pattern for the
second one. This should ensure that you get both: boxes with pattern and
a background color and a perfectly matching key.

The following script worked on my computer:

unset multiplot
reset

set terminal pngcairo size 800,550 font "Arial Narrow,18"
set output "Test01a.png"

set multiplot

set size 1.0,1.0
set origin 0.0,0.0
set samples 5

set key inside top center Left reverse samplen 2.0

XMIN = 0.0
XMAX = 1.0
XSTP = 0.1
set xrange [XMIN:XMAX]
set xtics XMIN,XSTP,XMAX
set xlabel "x"

YMIN = 0.0
YMAX = 1.0
YSTP = 0.2
set yrange [YMIN:YMAX]
set ytics YMIN,YSTP,YMAX
set ylabel "y"

set boxwidth 0.05 absolute

plot sin(x) title "sin(x)" with boxes fs solid 1.0 noborder lc rgb "green"


set size 1.0,1.0
set origin 0.0,0.0
set samples 5

set key inside top center Left reverse samplen 2.0

XMIN = 0.0
XMAX = 1.0
XSTP = 0.1
set xrange [XMIN:XMAX]
set xtics XMIN,XSTP,XMAX
set xlabel "x"

YMIN = 0.0
YMAX = 1.0
YSTP = 0.2
set yrange [YMIN:YMAX]
set ytics YMIN,YSTP,YMAX
set ylabel "y"

set boxwidth 0.05 absolute

plot sin(x) title "sin(x)" with boxes fs transparent pattern 1 border
rgb "black" lc rgb "black"

unset multiplot
unset output


I hope this helps.

Thomas
0 new messages