From: Alan W. I. <ir...@be...> - 2004-05-07 17:36:22
|
On 2004-05-07 13:16+0200 Arjen Markus wrote: > Hello, > > > Arjen, we need specifics. Otherwise, there is nothing we can do and nothing > > we can discuss. > > > > So please give us a simple programme example (or combination of options for > > a standard example) which demonstrates the png device problem you have found > > so we can replicate the problem for ourselves. > > > > >From walking through the code, I do see now that it has to do with the > dimensions > of my windows, more particularly the fact that I usually have > portrait-shaped > windows, rather than the 4/3 aspect ratio that PLplot uses by default. > > Because internally the x coordinate is scaled to fit within the range > 0-32767 > and the y coordinate is scaled to fit within 3/4 of that, the > coordinates that > my program uses exceed the limit of 32767. > > (I wil try to see if setting the -geometry option works - the PNG driver > supports > that) All coordinates are scaled and clipped in PLplot so I am quite interested that you found a case in the png device where you overflowed one of the coordinate integers. I believe that must be some sort of bug. I know from one point of view, you are trying to find a workaround (with say, the -geometry option) that will work for your set of users. But please (!) also take the developer's point of view. In addition to finding workarounds for the bug, give us a simple example where we can replicate the bug so that we can fix it. > > Another problem is that the color map (cmap0) is too small for my > program. > Is there a particular limit for PNG files or is it simply the > implementation? Each PLplot device is required to support 16 colours at minimum, but for certain devices the limit is much larger. For example, for the png device, the number of cmap0 (and also cmap1) colours is limited to 2^8/2 = 128 in 8-bit mode. But for 24-bit mode (available for the gd library that comes with most Linux distributions now), the number of possible cmap0 or cmap1 colours is limited to 2^24/2 = 8M ~ 8.3 million colours which should be adequate for most purposes. :-) In fact, in 24-bit mode I think the png and jpeg devices probably have support for a much larger number of colours than any of our other devices. To make sure you have 24-bit mode for the png device, use -dev png -drvopt 24bit . I just tried this combination of options myself, and the result was I could use 8M cmap0 colours with no problems other than taking 10 seconds or so to set up all those colours. BTW, I tried this test in python using # This makes length of red, green, and blue arrays = 8*1024*1024 scale = 32*1024 red = zeros(256*scale) # Maximum colour value is 255. green = arange(256*scale)/scale blue = zeros(256*scale) plscmap0(red, green, blue) Alan __________________________ Alan W. Irwin email: ir...@be... phone: 250-727-2902 Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the PLplot scientific plotting software package (plplot.org), the Yorick front-end to PLplot (yplot.sf.net), the Loads of Linux Links project (loll.sf.net), and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |