简体   繁体   中英

PostScriptTrace Error

I am trying to import a vector graphic of the brain into R using the GrImport function. When inserting the following function:

PostScriptTrace("~/Dropbox/shared/Brain_mapping/Human-brain.ps", "~/Dropbox/shared/Brain_mapping/Human-brain.xml")

I get this error:

Error in PostScriptTrace("~/Dropbox/Natasha_shared/Brain_mapping/Human-brain.ps",  : 
status 255 in running command 'gs -q -dBATCH -dNOPAUSE -sDEVICE=ps2write -sOutputFile=/dev/null -sstdout=~/Dropbox/Natasha_shared/Brain_mapping/Human-brain.xml captureHuman-brain.ps'

That doesn't appear to be a regular PostScript error, and I'm kind of puzzled by why the command has the device set to ps2write. ps2write produces PostScript as its output, I can't see why you would want to convert PostScript input into PostScript output!

Its also directing the output to /dev/null, so this command really doesn't seem to do anything useful. Oh, and the '-q' suppresses most error messages, which isn't helpful when debugging problems.

Can you share the original PostScript file ?

Most likely you have a bunch of characters in your vector graphics which are not in your fonts directory. A good work around which might work for you, is the following gs line which you have to run on the command line (NOT in R):

gs -sDEVICE=ps2write -dNOCACHE -sOutputFile=nochar_Human-brain.ps -q -dbatch -dNOPAUSE -dQUIET Human-brain.ps -c quit

After that you'll be left with a new vector file which you can use in R like this:

PostScriptTrace("nochar_Human-brain.ps", "nochar_Human-brain.xml")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM