Page 1 of 1
Incorrect Graphics Output to WMF
Posted: Mon Oct 10, 2016 9:07 pm
by pteterin
Hello all,
I am using RATS 9.00. I have defined custom styles in ConfidenceBands.txt and imported them using the following commands (and specified a few other items):
OPEN ConfBands "ConfidenceBands.txt"
GRPARM(IMPORT=ConfBands,FONT="Times") AXISLABELING 30 HLABEL 30 VLABEL 30
The style sheet contains the following:
LINE_BW_1=0,0.0,0.2
LINE_BW_2=1,0.0,0.2
LINE_BW_3=1,0.0,0.2
I then specify the option to save each graph as a Windows Meta File (I am using the older ENVIRONMENT command, but the described behavior is the same with the newer GSAVE):
ENVIRONMENT SHOWGRAPHS GSAVE="CMT_Reg1_Mat*.wmf" GFORMAT=WMF
I then produce several graphs, say:
GRAPH(PATTERNS,HEIGHT=4.0,WIDTH=8.0) 3
# RollCoeffs(2); # UpperBand(2); # LowerBand(2)
You can probably tell I am plotting rolling regression betas with confidence bands. I want the results to look like in the attached PDF (file Graph_Want.pdf; I got the PDF by printing to Adobe PDF straight from RATS when a graph is open). Instead, what is saved in the WMF is corrupted (file Graph_BAD.WMF). Interestingly, if I use the colors in the plot (instead of black and white patterns), the WMF file is saved correctly, albeit it is not the formatting that I want (file Graph_OK.WMF).
Note: the WMF files are in WMF.zip
Does anybody know why I get this WMF behavior?
Re: Incorrect Graphics Output to WMF
Posted: Mon Oct 10, 2016 9:42 pm
by TomDoan
WMF doesn't do a very good job with dashed lines. Is there a reason you're not using PDF or EPS for the graphs?
Re: Incorrect Graphics Output to WMF
Posted: Mon Oct 10, 2016 10:34 pm
by pteterin
TomDoan wrote:Is there a reason you're not using PDF or EPS for the graphs?
For this project, I am working with MS Word, so WMF is a natural choice for vector graphics. I am aware that RATS 9.10 supports export to PDF, but my current version (9.00) does not. Saving every single graph to a PDF document using the print dialog is an option, but less desirable than direct export.
In addition, I have had problems with EPS in the past - I ended up placing bitmap images in my LaTeX documents. Out of curiosity, I saved the same graph as above as EPS, and even PhotoShop would not render it - the rasterize dialog appears, but the result is an empty image. What could be the problem?
If I get RATS 9.10, would I need to install Ghostscript to export graphs to PDF on Windows?
Re: Incorrect Graphics Output to WMF
Posted: Tue Oct 11, 2016 9:34 am
by TomDoan
To do the direct export to PDF under Windows with version 9.1, yes, you need GhostScript. (PDF export is included on the Mac---don't know why Microsoft is behind the times with that).
WMF was really designed to move information from one Microsoft product to another. What RATS creates shows fine on the screen and prints directly fine, but the import of a file rendering (of dashed lines---everything else seems to work correctly--can fail. (Open Office doesn't handle it correctly, and there have been some vintages of MS products that didn't as well). However, it seems to work fine with the newer versions of Office.
Re: Incorrect Graphics Output to WMF
Posted: Tue Oct 11, 2016 11:31 am
by pteterin
TomDoan wrote:To do the direct export to PDF under Windows with version 9.1, yes, you need GhostScript. (PDF export is included on the Mac---don't know why Microsoft is behind the times with that).
I have just installed RATS 9.10b on my university desktop, along with GhostScript, and direct PDF export worked perfectly. This will serve all my future graphing needs since PDF can be seamlessly imported into both Word and LaTeX, and I happen to use both, depending on the project.
TomDoan wrote: However, it seems to work fine with the newer versions of Office.
I was using Word 2016, tried it on both desktop and laptop. It never worked right.
Re: Incorrect Graphics Output to WMF
Posted: Tue Oct 11, 2016 11:36 am
by TomDoan
pteterin wrote:
TomDoan wrote: However, it seems to work fine with the newer versions of Office.
I was using Word 2016, tried it on both desktop and laptop. It never worked right.
Did you try copy-and-paste rather than saving as WMF?
Re: Incorrect Graphics Output to WMF
Posted: Tue Oct 11, 2016 2:22 pm
by pteterin
TomDoan wrote:Did you try copy-and-paste rather than saving as WMF?
I have tried this method as well, but it did not work correctly either. The graph is inserted into Word as a wmf (I can tell because there is a context menu option within Word to save it as a picture), but what are supposed to be dotted lines are corrupted and instead displayed as solid lines with large chunks missing. So have you tried inserting the wmf files I have attached into Word, or do you never work on Windows?
I am happy now with the PDF export, but I could provide more details in case you need to get to the bottom of the issue to try to fix it in future releases.
Re: Incorrect Graphics Output to WMF
Posted: Tue Oct 11, 2016 3:56 pm
by pteterin
TomDoan wrote:Is there a reason you're not using PDF or EPS for the graphs?
I have a counter-question. Is there a reason RATS does not offer to save graphics as raster images (such as TIF or JPEG) at user-specified dpi? I am asking because I ended up using Acrobat to convert PDFs to TIF (Word imports PDFs at very low resolution, so they need to be converted to raster by the user if a higher resolution is desired). This is not a big inconvenience as Acrobat can batch process PDF files and I was able to get Elsevier-specified line graphics at 1000 dpi, but it would be nice to be able to save 1000 dpi raster images straight from RATS.