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

unwanted clipping of ylabel

6 views
Skip to first unread message

Alan G Isaac

unread,
Oct 31, 2009, 10:04:28 AM10/31/09
to
The econometric package gretl ships with a gnuplot,
which it uses for its graphs.

In gretl's gnuplot graphs, I'm seeing some clipping of the
text for the ylabel, and the gretl author believes this must
be traceable to gnuplot itself. So my question: has this been
seen at some point in gnuplot, and if so what was
the cause?

Any other speculation on a possible cause would be welcome...

Thanks,
Alan Isaac

Zoltan

unread,
Oct 31, 2009, 11:54:31 AM10/31/09
to
> Any other speculation on a possible cause would be welcome...

Well, I believe, we should see something. I mean, saying that clipping
occurs is a very broad statement. Could you, please, post at least a
screen shot and a minimal plot that produces this error? Or even
better, could you post the command that is passed to gnuplot by gretl?
Zoltán

Alan G Isaac

unread,
Oct 31, 2009, 1:39:32 PM10/31/09
to
> Zolt�n


I understand why you are requesting code, but I do not
yet have a reliably replicable situation. Indeed, using
just gnuplot I have not been able to produce the problem.
That's why I'm just asking if others have seen this problem
in any form.

By "clipping" I meant this:
at the extreme left (turn your head sideways ;-) ) of the ylabel,
I sometimes lose a one (?) pixel band, so that the first letter
does not appear correctly (e.g., a capital R will lack the line
that forms its leftmost part).

I hope that is a bit clearer; I will post more information
if I can discover a way to make this reliably reproducible.

Alan Isaac


Alan G Isaac

unread,
Oct 31, 2009, 11:27:13 PM10/31/09
to
Well I think I can add some relevant information at this point.
The problems seems to occur under Windows but not Linux, and
it seems to affect only the PNG driver.

Still investigating, but clues welcome ...

fwiw,
Alan Isaac

Zoltan

unread,
Nov 1, 2009, 6:00:26 AM11/1/09
to

But, again, what could shed some light on the issue at hand is knowing
what is passed by gretl to gnuplot. If the maintainer of gretl is so
confident that the problem is on gnuplot's side, then they must show
why they think it is so. I might be a bit overprotective of gnuplot,
and I don't know what the developers/other people make of this, but at
this point it is as saying that your car doesn't work, and it must be
the engine, while you are pouring water into the tank, instead of
gasoline. We must see what is passed to gnuplot not necessarily
because we think that gretl doesn't work properly, but it is the only
way to figure out which one is the faulty command in gnuplot. (If
there are any, that is.)
Cheers,
Zoltán

Alan G Isaac

unread,
Nov 1, 2009, 10:14:26 AM11/1/09
to
On 11/1/2009 6:00 AM, Zoltan wrote:
> But, again, what could shed some light on the issue at hand is knowing
> what is passed by gretl to gnuplot.

Well, here is an example.
This example gives me missing pixels along the "left" of the Q
and along the bottom of "Test".
fwiw,
Alan


set term pngcairo font "verdana,8" size 680,400
set encoding utf8
set style line 1 lc rgb "#ff0000"
set style line 2 lc rgb "#0000ff"
set style line 3 lc rgb "#00cc00"
set style line 4 lc rgb "#bf25b2"
set style line 5 lc rgb "#8faab3"
set style line 6 lc rgb "#ffa500"
set style increment user
# timeseries 1 (letterbox)
set xlabel ''
set xzeroaxis
set datafile missing "?"
set ylabel 'Q'
set nokey
set xrange [0:307.475]
set title "Test"
plot \
'-' using 1:($2) title "" w lines
1 -0.6867419962
2 0.3579594638
3 0.5578126624
4 -0.887759904
5 0.6368171064
6 -2.558622759
7 0.07843583307
8 1.485631567
9 0.3202910732
10 -1.100877694
11 -0.105341936
12 -0.2384109999
13 0.1464220686
14 -0.2953723062
15 1.981865851
16 -2.187149394
17 1.088018763
18 0.3590547415
19 -1.876996464
20 0.1455794326
21 0.3446911512
22 -0.56942131
23 1.161509939
24 0.1804356978
25 -0.550093845
26 -1.567315095
27 0.2805021446
28 -0.2584989888
29 0.04354487081
30 0.9927214842
31 0.2890895103
32 -0.1552247205
33 0.4033065499
34 1.691839335
35 0.9441755277
36 1.611620444
37 0.6675335463
38 0.5890985507
39 -0.7937908548
40 0.2491546438
41 2.324946146
42 -0.9879908854
43 2.145316015
44 -1.527070804
45 -0.765135307
46 -0.7029202149
47 -0.3475652511
48 1.96488897
49 -0.368143142
50 -0.5624254226
51 0.5836407434
52 -0.7691914108
53 0.5868992793
54 -0.4156096424
55 1.121636702
56 -1.826045482
57 -1.937814382
58 1.515774226
59 -0.4162987267
60 -0.07740353147
61 -0.01257240042
62 0.009487657889
63 0.6565792865
64 2.029354924
65 0.03175535834
66 -1.745066812
67 0.6407232388
68 -2.911516056
69 -1.69776772
70 -0.2289167203
71 2.155330168
72 -1.460414642
73 -0.05638052471
74 -0.616460842
75 0.2008343509
76 1.689767271
77 -0.7967433284
78 1.502901257
79 1.200341313
80 0.9737454604
81 -1.121632902
82 -1.14626532
83 1.394481768
84 0.767891942
85 0.4483870075
86 -1.689238571
87 0.2808410434
88 -0.3402960066
89 -0.3289481569
90 0.1060248954
91 -1.968389217
92 0.1448517792
93 -0.1151421076
94 2.306335086
95 1.368072315
96 0.9190993046
97 -0.5340921378
98 0.1091799669
99 -2.121804856
100 -0.4407809449
101 1.377453282
102 -1.30467998
103 0.7074049414
104 -0.5373523429
105 -0.1032061135
106 -0.7792997219
107 0.8652621745
108 0.4258778316
109 0.6731019915
110 0.6209047533
111 0.4365852509
112 -1.476144087
113 -1.162177389
114 -0.2911305759
115 2.921574075
116 -0.1545187991
117 0.4976567895
118 -0.4187955112
119 -0.9167013529
120 0.9943848528
121 -1.955553411
122 -0.9249448831
123 1.004776861
124 0.4770414359
125 0.06231415642
126 -1.006045153
127 0.8420007598
128 1.75742462
129 1.195494519
130 -2.508771591
131 -0.1133520813
132 -0.4887066286
133 -0.4056811596
134 1.544691742
135 0.6041787078
136 1.089970752
137 1.247950444
138 -0.04190226238
139 -0.4041657649
140 0.812211931
141 -1.604975604
142 -1.182415823
143 0.5872852098
144 -0.3626788875
145 -0.5001048041
146 -1.791409852
147 -0.8645248441
148 -0.03852609677
149 0.3111704767
150 -0.4068483688
151 0.8044950557
152 0.3117590656
153 -1.407456036
154 -1.594649225
155 -0.3127630788
156 -0.2878605339
157 -0.7446872636
158 0.9497205002
159 0.5511613698
160 0.1995596956
161 -0.5528250746
162 -0.418964985
163 -2.385752707
164 1.162948354
165 -1.396029805
166 -0.3733413797
167 1.593670559
168 -0.04205028082
169 0.8896743284
170 -0.415291674
171 -0.3921038517
172 0.5362265617
173 0.9010750615
174 -0.1716041551
175 1.904713318
176 0.5025793159
177 0.1655372571
178 0.05181612624
179 -0.7184955121
180 1.62322102
181 -0.7319719762
182 0.2515712368
183 -0.5541282274
184 0.5724881766
185 -1.598175182
186 -0.1967558517
187 -0.3920737098
188 1.810900062
189 0.3806171329
190 0.441181286
191 -0.865832364
192 -0.5773359821
193 1.359613572
194 -1.596129973
195 -0.02417019406
196 0.6443324706
197 -0.181686177
198 -1.733023708
199 -1.656090618
200 0.1080001682
201 0.4335730754
202 -0.5812495934
203 0.1701813685
204 1.526844118
205 0.1291493555
206 0.9944244848
207 -0.6204853658
208 -0.0166597704
209 -0.3775487502
210 -0.8525266145
211 0.2606457709
212 -2.185382608
213 -2.189939273
214 -0.1846054528
215 0.428746571
216 -0.9096007052
217 -0.1420758969
218 -2.38848279
219 0.7130755252
220 1.010199184
221 0.1365355906
222 0.07972561538
223 -0.05269203882
224 1.109890569
225 -0.1349366315
226 -2.227820709
227 0.3499041867
228 1.589670469
229 -0.6103127107
230 0.6835957481
231 -0.5034386488
232 -0.5890887723
233 -1.410574554
234 -1.186169813
235 -0.3720170741
236 0.8191841626
237 -1.566480134
238 0.1028450403
239 -0.5250707221
240 1.226090819
241 -1.408907389
242 1.02282367
243 0.6709559501
244 0.8089988735
245 -1.106647081
246 0.04400055843
247 -0.5718548484
248 -0.1858178259
249 -1.426155953
250 -0.7299632993
251 0.7077881959
252 -0.1692605868
253 -1.762911698
254 -0.05538783981
255 -1.216636634
256 -0.5956968153
257 0.2606275496
258 0.4928456014
259 -0.706401276
260 1.159541659
261 1.266782162
262 -0.7078710767
263 -1.175554545
264 0.1894322168
265 0.3814917742
266 -0.3434157008
267 -1.244979659
268 0.4515895273
269 0.1353766049
270 -1.035764683
271 0.9925137257
272 1.167874463
273 -0.2507898094
274 0.06522113616
275 1.081873594
276 -0.01782740056
277 0.4442337608
278 0.4087770995
279 0.7258066743
280 0.45271582
281 -0.6315149151
282 -0.2000126239
283 -0.9313488308
284 -0.1748486581
285 -0.5240394447
286 0.9801023899
287 1.672049949
288 0.3552486829
289 -1.302317974
290 -0.1589387793
291 0.6308137446
292 -1.817425176
293 -1.227742803
294 0.3144610123
295 -0.162831057
296 -0.211408596
297 -0.726129033
298 0.1318899399
299 1.663772193
300 -1.363071792
e

sfeam

unread,
Nov 1, 2009, 5:32:55 PM11/1/09
to
Alan G Isaac wrote:

> On 11/1/2009 6:00 AM, Zoltan wrote:
>> But, again, what could shed some light on the issue at hand is
>> knowing what is passed by gretl to gnuplot.
>
> Well, here is an example.
> This example gives me missing pixels along the "left" of the Q
> and along the bottom of "Test".

[snip]

I see no problems in the output when your script is run here.
The png output file it produces may be viewed here:
http://skuld.bmsc.washington.edu/~merritt/gnuplot/gretl_bug.png

Alan G Isaac

unread,
Nov 1, 2009, 8:46:23 PM11/1/09
to
On 11/1/2009 5:32 PM, sfeam wrote:
> I see no problems in the output when your script is run here.
> The png output file it produces may be viewed here:
> http://skuld.bmsc.washington.edu/~merritt/gnuplot/gretl_bug.png


Are you running this
1. on Windows, and
2. using pngcairo

That is the combination that produces the problem.
The problem is only (easily) visible at smaller font
sizes, such as Verdana font at 8 points. Here is the
output for comparison:
http://www1.american.edu/cas/econ/faculty/isaac/misc/gnuplot_bug.png

At this point it seems likely (to me)
that there is a bug in the
pngcairo back end under Windows.

Alan

sfeam

unread,
Nov 2, 2009, 12:13:28 AM11/2/09
to
Alan G Isaac wrote:

> On 11/1/2009 5:32 PM, sfeam wrote:
>> I see no problems in the output when your script is run here.
>> The png output file it produces may be viewed here:
>> http://skuld.bmsc.washington.edu/~merritt/gnuplot/gretl_bug.png
>
>
> Are you running this
> 1. on Windows, and
> 2. using pngcairo

Windows - no
pngcairo - yes (see below)

> That is the combination that produces the problem.
> The problem is only (easily) visible at smaller font
> sizes, such as Verdana font at 8 points. Here is the
> output for comparison:
> http://www1.american.edu/cas/econ/faculty/isaac/misc/gnuplot_bug.png

I see what you mean. I'm not sure that you are seeing clipping.
It could also be defective font rendering.
Do you see the same problem in the other cairo-based terminals
(pdfcairo, wxt)?

> At this point it seems likely (to me)
> that there is a bug in the
> pngcairo back end under Windows.

Gnuplot has only the one cairo terminal. It supports both png and pdf,
and the code is shared by all platforms including Windows.
I don't know what is causing your defective rendering, but I'm
pretty sure it is not in gnuplot per se. Is your executable linked
against shared libraries (*.dll) for pango and pangocairo? If so,
I'd try looking for other versions. If it is a statically linked
executable built by someone else, then I think you will need to involve
them in the debugging.


Alan G Isaac

unread,
Nov 2, 2009, 10:48:49 AM11/2/09
to
> Alan G Isaac wrote:
>> Are you running this
>> 1. on Windows, and
>> 2. using pngcairo

On 11/2/2009 12:13 AM, sfeam wrote:
> Windows - no
> pngcairo - yes (see below)

That won't do it: the problem is only
on Windows, and only using pngcairo.

>> http://www1.american.edu/cas/econ/faculty/isaac/misc/gnuplot_bug.png



On 11/2/2009 12:13 AM, sfeam wrote:
> It could also be defective font rendering.

Yes, I know thing that is likely, but why only
with smaller font sizes? (Or maybe it is only
noticeable then?)


On 11/2/2009 12:13 AM, sfeam wrote:
> Do you see the same problem in the other cairo-based terminals
> (pdfcairo, wxt)?

pdfcairo works fine.
I'll try to get more answers.

Thanks,
Alan

sfeam

unread,
Nov 2, 2009, 2:33:28 PM11/2/09
to
Alan G Isaac wrote:
> On 11/2/2009 12:13 AM, sfeam wrote:
>> Windows - no
>> pngcairo - yes (see below)
>
> That won't do it: the problem is only
> on Windows, and only using pngcairo.
>
>>> http://www1.american.edu/cas/econ/faculty/isaac/misc/gnuplot_bug.png
>
> On 11/2/2009 12:13 AM, sfeam wrote:
>> It could also be defective font rendering.
>
> Yes, I know thing that is likely, but why only
> with smaller font sizes? (Or maybe it is only
> noticeable then?)

Why only smaller font sizes?
Because the way ttf fonts work is that the shape is originally
described appropriately for some particular size, and then various
rules and hints are attached to suggest how to modify the shape
when scaling up or down. My guess is that the problem is due
to use or non-use of hinting, and use or non-use of antialiasing.

>> Do you see the same problem in the other cairo-based terminals
>> (pdfcairo, wxt)?
>
>pdfcairo works fine.

OK, that's interesting. We request full hinting for png output but
turn it off for pdf output. You could try this simple change to cairo.trm:

--- ./cairo.trm.buggy 2009-09-13 10:49:16.000000000 -0700
+++ ./cairo.trm 2009-11-02 11:30:02.000000000 -0800
@@ -418,8 +418,8 @@ void cairotrm_init()
surface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32,
plot.device_xmax /*double width_in_points*/,
plot.device_ymax /*double height_in_points*/);
- /* png is bitmapped, let's do the full hinting */
- plot.hinting = 100;
+ /* png should like hinting, but there seems to be a problem */
+ plot.hinting = 0;
/* png is produced by cairo "image" backend, which has full support
* of OPERATOR_SATURATE */
plot.polygons_saturate = TRUE;

Alan G Isaac

unread,
Nov 2, 2009, 6:09:37 PM11/2/09
to
On 11/2/2009 2:33 PM, sfeam wrote:
> You could try this simple change to cairo.trm:

I passed this to the gretl developers, and I
expect they will report back here. Ow, I'll
try to.

Thanks!
Alan

Alan G Isaac

unread,
Nov 4, 2009, 10:55:45 AM11/4/09
to
On 11/2/2009 6:09 PM, Alan G Isaac wrote:
> I passed this to the gretl developers, and I
> expect they will report back here.

This discussion will move to the gnuplot-beta list.

Thanks,
Alan Isaac

sfeam

unread,
Nov 6, 2009, 10:43:10 PM11/6/09
to
Alan G Isaac wrote:

Workaround/fix now in CVS, courtesy of Allin Cottrell
with advice from cairo developer Behdad Esfahbod.
However, to benefit from the fix you must have libfreetype
available so that it can be used in preference to the
Win32 font rendering.

Ethan

0 new messages