From: Ethan A M. <me...@uw...> - 2020-05-01 22:40:14
|
On Friday, 1 May 2020 14:04:22 PDT Dima Kogan wrote: > Hi. The docs (help fillstyle) say that the default fillstyle is "empty". > But this isn't what's happening: > > set grid > set object rectangle from 0,0 to 1,1 > plot [-1:2][-1:2] x > > Note that the grid lines do not show up behind the rectangle. If I > explicitly add "fillstyle empty" to the rectangle definition, you get > the transparent rectangle. Going way back to the initial implementation of rectangle as objects, the default was "solid fill with background color", which is not the same thing as "empty". This is true for all object types. gnuplot> help set style rectangle Rectangles defined with the `set object` command can have individual styles. However, if the object is not assigned a private style then it inherits a default that is taken from the `set style rectangle` command. [snip] The default values correspond to solid fill with the background color and a black border. The idea was to have separate global fill styles for each object type. In retrospect that might not have been the best idea, but that's what we have. In retrospect it might also have been better to have all global fill styles start with the same default. What do you think? Is it worth breaking backward compatibility to change this? I'm inclined to say yes, but only in the development verion, not for 5.4. Do away with separate fillstyles? Keep them but give them all the same default properties? There is another very messy historical artifact about fill styles that goes with this and affects many many places in the code. Example: plot FOO with candlesticks lt 3 At the time it seemed reasonable that if the fillstyle was "empty", this meant to use the color of linetype 3 for the border of the candlestick boxes. But if the fillstyle was "solid" it meant use the color of linetype 3 for the fill area, not the border. See the problem? Then it got worse when "set fillstyle" got a bordercolor property and worse again when linetype and linecolor became differentiated. This adds complexity and non-obvious side effects in a lot of places. When the code sees "plot ... with boxes lc foo", where should it store that color? As the linecolor of the plot? As the bordercolor of the fillstyle for that plot? As the fill color for the fillstyle for that plot? Right now it's a messy combination of all three options depending on whether the fillstyle is EMPTY or SOLID and depending on whether we are in pm3d or hidden3d mode. Ugh. It would be much nicer to rationalize where colors are stored, even if it means adding yet more places to the plot structure. But that would be quite a lot of work and likely to generate a trail of bug reports because it touches the code in so many places. Maybe a wishlist item for version 6? Ethan |