Problem writing SCATTERPLOT() with more than 4096 points to PDF file [message #91175] |
Thu, 11 June 2015 11:19  |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
I am having problems writing a SCATTERPLOT() to a PDF file.
The following plot displays correctly in a window.
x = randomn(seed,4096)
y = randomn(seed,4096)
p = scatterplot(x,y,/sym_filled,sym_color='blue',symbol='circle' )
But when I then try to save to a PDF file, I get the error message:
% SAVE: Error in PDF creation: INVALID_SHADING
I have no problems when saving the plot in other data formats.
There also is no problem if I plot less than 4096 points.
Finally, the problem still exists if I first open a window with /BUFFER and write directly to a PDF file.
Thanks, --Wayne
w = window(dimen=[800,1100],/buffer)
x = randomn(seed,4096)
y = randomn(seed,4096)
p = scatterplot(x,y,/current,/sym_filled,sym_color='blue',symbol ='circle')
w.save,'test.pdf'
IDL> print,!version
{ x86_64 darwin unix Mac OS X 8.4 Sep 27 2014 64 64}
|
|
|
Re: Problem writing SCATTERPLOT() with more than 4096 points to PDF file [message #91176 is a reply to message #91175] |
Thu, 11 June 2015 12:00   |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Thursday, June 11, 2015 at 8:19:37 PM UTC+2, wlandsman wrote:
> I am having problems writing a SCATTERPLOT() to a PDF file.
>
> The following plot displays correctly in a window.
>
> x = randomn(seed,4096)
> y = randomn(seed,4096)
> p = scatterplot(x,y,/sym_filled,sym_color='blue',symbol='circle' )
>
> But when I then try to save to a PDF file, I get the error message:
>
> % SAVE: Error in PDF creation: INVALID_SHADING
>
> I have no problems when saving the plot in other data formats.
>
> There also is no problem if I plot less than 4096 points.
>
> Finally, the problem still exists if I first open a window with /BUFFER and write directly to a PDF file.
>
> Thanks, --Wayne
>
>
> w = window(dimen=[800,1100],/buffer)
> x = randomn(seed,4096)
> y = randomn(seed,4096)
>
> p = scatterplot(x,y,/current,/sym_filled,sym_color='blue',symbol ='circle')
> w.save,'test.pdf'
>
> IDL> print,!version
> { x86_64 darwin unix Mac OS X 8.4 Sep 27 2014 64 64}
Just to add some statistics: I get the same results.
IDL> !version
{
"ARCH": "x86_64",
"OS": "Win32",
"OS_FAMILY": "Windows",
"OS_NAME": "Microsoft Windows",
"RELEASE": "8.4.1",
"BUILD_DATE": "Feb 17 2015",
"MEMORY_BITS": 64,
"FILE_OFFSET_BITS": 64
}
Cheers,
Helder
|
|
|
Re: Problem writing SCATTERPLOT() with more than 4096 points to PDF file [message #91178 is a reply to message #91176] |
Thu, 11 June 2015 16:26   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Thursday, June 11, 2015 at 1:00:50 PM UTC-6, Helder wrote:
> On Thursday, June 11, 2015 at 8:19:37 PM UTC+2, wlandsman wrote:
>> I am having problems writing a SCATTERPLOT() to a PDF file.
>>
>> The following plot displays correctly in a window.
>>
>> x = randomn(seed,4096)
>> y = randomn(seed,4096)
>> p = scatterplot(x,y,/sym_filled,sym_color='blue',symbol='circle' )
>>
>> But when I then try to save to a PDF file, I get the error message:
>>
>> % SAVE: Error in PDF creation: INVALID_SHADING
>>
>> I have no problems when saving the plot in other data formats.
>>
>> There also is no problem if I plot less than 4096 points.
>>
>> Finally, the problem still exists if I first open a window with /BUFFER and write directly to a PDF file.
>>
>> Thanks, --Wayne
>>
>>
>> w = window(dimen=[800,1100],/buffer)
>> x = randomn(seed,4096)
>> y = randomn(seed,4096)
>>
>> p = scatterplot(x,y,/current,/sym_filled,sym_color='blue',symbol ='circle')
>> w.save,'test.pdf'
>>
>> IDL> print,!version
>> { x86_64 darwin unix Mac OS X 8.4 Sep 27 2014 64 64}
>
> Just to add some statistics: I get the same results.
> IDL> !version
> {
> "ARCH": "x86_64",
> "OS": "Win32",
> "OS_FAMILY": "Windows",
> "OS_NAME": "Microsoft Windows",
> "RELEASE": "8.4.1",
> "BUILD_DATE": "Feb 17 2015",
> "MEMORY_BITS": 64,
> "FILE_OFFSET_BITS": 64
> }
>
> Cheers,
> Helder
I can confirm that this is indeed a bug. I doubt it will get fixed for IDL 8.5. As a workaround, you can use the /BITMAP keyword when saving to the PDF.
Cheers,
Chris
|
|
|
Re: Problem writing SCATTERPLOT() with more than 4096 points to PDF file [message #94323 is a reply to message #91178] |
Mon, 10 April 2017 11:18   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Thursday, June 11, 2015 at 5:26:22 PM UTC-6, Chris Torrence wrote:
> On Thursday, June 11, 2015 at 1:00:50 PM UTC-6, Helder wrote:
>> On Thursday, June 11, 2015 at 8:19:37 PM UTC+2, wlandsman wrote:
>>> I am having problems writing a SCATTERPLOT() to a PDF file.
>>>
>>> The following plot displays correctly in a window.
>>>
>>> x = randomn(seed,4096)
>>> y = randomn(seed,4096)
>>> p = scatterplot(x,y,/sym_filled,sym_color='blue',symbol='circle' )
>>>
>>> But when I then try to save to a PDF file, I get the error message:
>>>
>>> % SAVE: Error in PDF creation: INVALID_SHADING
>>>
>>> I have no problems when saving the plot in other data formats.
>>>
>>> There also is no problem if I plot less than 4096 points.
>>>
>>> Finally, the problem still exists if I first open a window with /BUFFER and write directly to a PDF file.
>>>
>>> Thanks, --Wayne
>>>
>>>
>>> w = window(dimen=[800,1100],/buffer)
>>> x = randomn(seed,4096)
>>> y = randomn(seed,4096)
>>>
>>> p = scatterplot(x,y,/current,/sym_filled,sym_color='blue',symbol ='circle')
>>> w.save,'test.pdf'
>>>
>>> IDL> print,!version
>>> { x86_64 darwin unix Mac OS X 8.4 Sep 27 2014 64 64}
>>
>> Just to add some statistics: I get the same results.
>> IDL> !version
>> {
>> "ARCH": "x86_64",
>> "OS": "Win32",
>> "OS_FAMILY": "Windows",
>> "OS_NAME": "Microsoft Windows",
>> "RELEASE": "8.4.1",
>> "BUILD_DATE": "Feb 17 2015",
>> "MEMORY_BITS": 64,
>> "FILE_OFFSET_BITS": 64
>> }
>>
>> Cheers,
>> Helder
>
> I can confirm that this is indeed a bug. I doubt it will get fixed for IDL 8.5. As a workaround, you can use the /BITMAP keyword when saving to the PDF.
>
> Cheers,
> Chris
It's been a while, but I did some more digging. This is actually a limitation of the PDF 1.4 specification. You can only have up to 4095 shading elements. See the spec here:
http://www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pd f_reference_archives/PDFReference.pdf
So unfortunately there's no way for us to fix this. The best workaround is to use /BITMAP.
Cheers,
Chris
|
|
|
Re: Problem writing SCATTERPLOT() with more than 4096 points to PDF file [message #94341 is a reply to message #94323] |
Fri, 14 April 2017 10:21   |
Heinz Stege
Messages: 189 Registered: January 2003
|
Senior Member |
|
|
On Mon, 10 Apr 2017 11:18:38 -0700 (PDT), Chris Torrence wrote:
If shading is not important for you and you have installed ghostscript
on your system, you can try "good old direct graphics". Here is a demo
for Windows. It should need only small changes for Linux and Mac.
psfile='scatterplot_demo.ps'
pdffile='scatterplot_demo.pdf'
page_width=29.7
page_height=21.
set_plot,'ps'
device,/color,/isolatin1
device,xsize=page_width-3.,ysize=page_height-2.5,xoff=1.5,yo ff=1.
device,file=psfile
temp=findgen(17)*!pi/8.
usersym,cos(temp),sin(temp),/fill
blue='ff5000'x
tvlct,byte(blue,0,1,3),10
x=randomn(seed,4096)
y=randomn(seed,4096)
plot,x,y,/nodata
oplot,x,y,psym=8,syms=.5,color=10
device,/close
factor=720./2.54
command='"'+getenv('ProgramFiles')+'\gs\gs8.61\bin\gswin32c.exe "'+$
' -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite'+$
' -dPDFSETTINGS=/prepress'+$
' -dDEVICEWIDTH='+strtrim(round(page_width*factor),2)+$
' -dDEVICEHEIGHT='+strtrim(round(page_height*factor),2)+$
' -sOutputFile="'+pdffile+'" "'+psfile+'"'
spawn,command,stdout,stderr,/noshell
if stdout ne '' then print,stdout
if stderr ne '' then print,stderr
Cheers, Heinz
|
|
|
Re: Problem writing SCATTERPLOT() with more than 4096 points to PDF file [message #94342 is a reply to message #94323] |
Fri, 14 April 2017 12:26   |
lecacheux.alain
Messages: 325 Registered: January 2008
|
Senior Member |
|
|
Le lundi 10 avril 2017 20:18:40 UTC+2, Chris Torrence a écrit :
> On Thursday, June 11, 2015 at 5:26:22 PM UTC-6, Chris Torrence wrote:
>> On Thursday, June 11, 2015 at 1:00:50 PM UTC-6, Helder wrote:
>>> On Thursday, June 11, 2015 at 8:19:37 PM UTC+2, wlandsman wrote:
>>>> I am having problems writing a SCATTERPLOT() to a PDF file.
>>>>
>>>> The following plot displays correctly in a window.
>>>>
>>>> x = randomn(seed,4096)
>>>> y = randomn(seed,4096)
>>>> p = scatterplot(x,y,/sym_filled,sym_color='blue',symbol='circle' )
>>>>
>>>> But when I then try to save to a PDF file, I get the error message:
>>>>
>>>> % SAVE: Error in PDF creation: INVALID_SHADING
>>>>
>>>> I have no problems when saving the plot in other data formats.
>>>>
>>>> There also is no problem if I plot less than 4096 points.
>>>>
>>>> Finally, the problem still exists if I first open a window with /BUFFER and write directly to a PDF file.
>>>>
>>>> Thanks, --Wayne
>>>>
>>>>
>>>> w = window(dimen=[800,1100],/buffer)
>>>> x = randomn(seed,4096)
>>>> y = randomn(seed,4096)
>>>>
>>>> p = scatterplot(x,y,/current,/sym_filled,sym_color='blue',symbol ='circle')
>>>> w.save,'test.pdf'
>>>>
>>>> IDL> print,!version
>>>> { x86_64 darwin unix Mac OS X 8.4 Sep 27 2014 64 64}
>>>
>>> Just to add some statistics: I get the same results.
>>> IDL> !version
>>> {
>>> "ARCH": "x86_64",
>>> "OS": "Win32",
>>> "OS_FAMILY": "Windows",
>>> "OS_NAME": "Microsoft Windows",
>>> "RELEASE": "8.4.1",
>>> "BUILD_DATE": "Feb 17 2015",
>>> "MEMORY_BITS": 64,
>>> "FILE_OFFSET_BITS": 64
>>> }
>>>
>>> Cheers,
>>> Helder
>>
>> I can confirm that this is indeed a bug. I doubt it will get fixed for IDL 8.5. As a workaround, you can use the /BITMAP keyword when saving to the PDF.
>>
>> Cheers,
>> Chris
>
> It's been a while, but I did some more digging. This is actually a limitation of the PDF 1.4 specification. You can only have up to 4095 shading elements. See the spec here:
> http://www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pd f_reference_archives/PDFReference.pdf
>
> So unfortunately there's no way for us to fix this. The best workaround is to use /BITMAP.
>
> Cheers,
> Chris
In the meantime (IDL 8.7 ?), a simple solution would be to insert your plot, first saved in PNG format for instance, into some program like WORD or POWERPOINT, and then save it to a PDF file. Not a big task.
alx.
|
|
|
Re: Problem writing SCATTERPLOT() with more than 4096 points to PDF file [message #94352 is a reply to message #94342] |
Mon, 17 April 2017 11:26   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Friday, April 14, 2017 at 1:26:04 PM UTC-6, alx wrote:
> Le lundi 10 avril 2017 20:18:40 UTC+2, Chris Torrence a écrit :
>
> In the meantime (IDL 8.7 ?), a simple solution would be to insert your plot, first saved in PNG format for instance, into some program like WORD or POWERPOINT, and then save it to a PDF file. Not a big task.
> alx.
Or, you can still save it to a PDF, just use the /BUFFER keyword. It will produce the same end result, without having to go thru a PNG.
x = randomn(seed,4096)
y = randomn(seed,4096)
p = scatterplot(x,y,/sym_filled,sym_color='blue',symbol='circle' )
p.save, 'out.pdf', /BITMAP
Cheers,
Chris
|
|
|
Re: Problem writing SCATTERPLOT() with more than 4096 points to PDF file [message #94354 is a reply to message #94352] |
Tue, 18 April 2017 02:13   |
lecacheux.alain
Messages: 325 Registered: January 2008
|
Senior Member |
|
|
Le lundi 17 avril 2017 20:26:40 UTC+2, Chris Torrence a écrit :
> On Friday, April 14, 2017 at 1:26:04 PM UTC-6, alx wrote:
>> Le lundi 10 avril 2017 20:18:40 UTC+2, Chris Torrence a écrit :
>>
>> In the meantime (IDL 8.7 ?), a simple solution would be to insert your plot, first saved in PNG format for instance, into some program like WORD or POWERPOINT, and then save it to a PDF file. Not a big task.
>> alx.
>
> Or, you can still save it to a PDF, just use the /BUFFER keyword. It will produce the same end result, without having to go thru a PNG.
>
> x = randomn(seed,4096)
> y = randomn(seed,4096)
> p = scatterplot(x,y,/sym_filled,sym_color='blue',symbol='circle' )
> p.save, 'out.pdf', /BITMAP
>
> Cheers,
> Chris
Is the resolution actually preserved in using /BITMAP ?
Cheers,
alx.
|
|
|
Re: Problem writing SCATTERPLOT() with more than 4096 points to PDF file [message #94423 is a reply to message #94354] |
Thu, 18 May 2017 09:54  |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Tuesday, April 18, 2017 at 3:13:27 AM UTC-6, alx wrote:
> Le lundi 17 avril 2017 20:26:40 UTC+2, Chris Torrence a écrit :
>> On Friday, April 14, 2017 at 1:26:04 PM UTC-6, alx wrote:
>>> Le lundi 10 avril 2017 20:18:40 UTC+2, Chris Torrence a écrit :
>>>
>>> In the meantime (IDL 8.7 ?), a simple solution would be to insert your plot, first saved in PNG format for instance, into some program like WORD or POWERPOINT, and then save it to a PDF file. Not a big task.
>>> alx.
>>
>> Or, you can still save it to a PDF, just use the /BUFFER keyword. It will produce the same end result, without having to go thru a PNG.
>>
>> x = randomn(seed,4096)
>> y = randomn(seed,4096)
>> p = scatterplot(x,y,/sym_filled,sym_color='blue',symbol='circle' )
>> p.save, 'out.pdf', /BITMAP
>>
>> Cheers,
>> Chris
>
> Is the resolution actually preserved in using /BITMAP ?
> Cheers,
> alx.
The default resolution is 300 dots-per-inch. You can change that with the RESOLUTION keyword if you need higher or lower.
-Chris
|
|
|