I am using Inkscape 0.91 and trying to add Latex math formula inside my graphics. After several hours of tying and fixes from the I am still not able make it work. I am on Windows 7 with the following,
1) pstoedit (pstoeditsetup_win32.exe)
2) GSview 5.0 (gsv50w32.exe)
3) Ghostscript 9.18 (gs918w32.exe)
4) miktex 2.59 64 bit version
I have added the PATHs and did all the stuff. I can see the Latex extension as well but whenever I try to use it I face the following error:
"Problem during opening C:\Program Files (x86)\pstoedit\drvmagick.dll:The specified module could not be found."
I couldn't find any solution to this so far.
So basically you are seeing this error while trying to use laTeX to add a formula or text to your drawing. as explained in this page you go to Extensions->Render->LaTeX. but the same error happened on windows 10 and Inkscape 0.92:
Doing some search I found this post in Inkscape forums. There several possible soloutions have been proposed, but the one which worked for me was to delete the faulty file:
drvmagick.dll
and it now works just fine.
Related
i have been trying to implement a tikz chunk in bookdown first by myself, then by following this thread.
unfornutately, i keep running into various errors and incompatibilities, such as this one:
Error in tools::texi2dvi(texf, pdf = !to_svg, clean = TRUE) :
unable to run 'pdflatex' on '.\tikzf702b605920.tex'
(even though by itself tinytex::pdflatex('test.tex') works fine)
on his blog and github Yihui Xie mentioned that it's definitely possible, but i wasn't able to find any working example, so i was hoping if perhaps anyone here could share one, please (or point out what am i doing wrong)
#PaulLemmens, i found what was the problem for me. disclaimer here, i use windows and none of my colleagues who use r on linux/macos have this problem.
issue was arising with knitr when engine=tikz is used in one of the chunks. For it to work installation of imagemagick (https://www.imagemagick.org/script/index.php) and GhostScript (https://www.ghostscript.com/) is needed. as well as that, i had to rewrite knitr (https://github.com/darthaline/knitr) slightly. it's a quick and dirty solution, but it worked for me. on line 281 of R/engine.R the path to imagemagick's convert is hardcoded cause otherwise it seems that windows interprets it as 'convert.exe' from System32 directory (ImageMagick PATH not being recognized with engine = "tikz" in knitr)
This is an issue I am encountering for different pieces of codes I am writing in R.
Basically, I would like to generate a window that displays a picture (a .png file). Following for instance guidances from this or this, I come up with this kind of code:
library(tcltk)
tmpFile <- tempfile(fileext = ".png")
download.file("https://www.r-project.org/logo/Rlogo.png", tmpFile)
tcl("image","create","photo", "imageLogo", file=tmpFile)
win1 <- tktoplevel()
tkpack(ttklabel(win1, image="imageLogo", compound="image"))
This works fine under Mac OS, but not on Linux nor on Windows, where I am displayed such an error message:
[tcl] couldn't recognize data in image file
I can find some workarounds when I want to display graphs, using for instance packages tkrplot or igraph. Nonetheless, I would be really eager to understand why I got such errors when running my scripts on Linux or Windows, whereas it works just fine on Mac OS.
Apologies in case this issue is obvious, but I haven't found anything about potential differences with the tcltk package depending on the OS.
Tk's native support for PNG was added in 8.6. Prior to that, you need to have the tkimg extension loaded into Tk to add the image format handler required. If your installation of Tcl/Tk that R is using is set up right, you can probably make it work with:
tclRequire("Img")
once you've initialised things sufficiently. Yes, the name used internally is “Img” for historical reasons, but that's just impossible to search for! (This is the key thing in this mailing list message from way back.)
However, upgrading the versions of Tcl and Tk to 8.6 is likely to be a better move.
Finally and a bit lately, I would like to close this issue and sum up the different suggestions that were kindly made in response of my question:
R comes along with Tcl 8.5, even with the latest version 3.3.2, which means that there is no way for embedding a PNG file with the usual command into a window created thanks to Tcl/Tk. For some reasons it is working on Mac OS, but do not expect this to work easily on other OSs.
In order to display pictures, graphs, etc. in a window generated by Tcl/Tk in R, better look for either using the GIF support (when possible) or trying alternative solutions (see the question for possible alternative options).
In case one really wants to display PNG files, the solution consists of installing Tcl 8.5 (for instance ActiveTcl) along with the extension Img. In order to use the Tcl/Tk package that you've just installed on your computer, you can refer to the R FAQ for Windows for instance (as stated in the FAQ, you need to install Tcl 8.5 - I tried with Tcl 8.6, thereby hoping to solve my issue, but it didn't work). Basically, you need to set up an environment variable (MY_TCLTK) and put the path where the package Tcl/Tk is installed. Needless to be said, Tcl/Tk is commonly used in R in order to implement GUIs; if you have to go through very complex procedures to set up the system, the package definitely loses its advantages.
Finally, since Tcl 8.6 should be available soon or later with R (already implemented in the devel version), this issue will be de facto outdated.
I am trying to use the R function dmvnorm (found in the mvtnorm package) in Sublime Text 3. I installed it and ran my code in RStudio, so I know the code is fine. In sublime, I entered:
install.packages('mvtnorm',repos='http://cran.us.r-project.org')
library(mvtnorm)
It looked as though it worked, but when I ran my code it said:
Error: could not find function "dmvnorm"
I'm using a Mac and my hunch is this is somehow related to specifying the path in Preferences -> Package Settings -> Sublime REPL -> Settings - User. The current path displayed as part of the error reads:
[path: /usr/bin:/bin:/usr/sbin:/sbin]
Thanks!
I had a hard time with this recently as well. I'm very new to R so I'm not sure this is the best answer, but to hold you off until someone gives a better one, did you include library('package.name') in the file (in sublime)? require('package.name') also works, but this appears not to be best practice for reasons described, e.g., here.
I hope this helps!
I created several simple ggplot2 plots and saved them to PDF files using the following commands:
p <- ggplot(plotobject, aes(x=Pos, y=Pval),res=300)
ggsave(plot=p,height=6,width=6,dpi=200, filename="~/example.pdf")
If I now open this example.pdf in Adobe Illustrator I get the following error:
The font AdobePiStd is missing. Affected text will be displayed using
a substitute font.
Is there a way in ggplot2 to specify a font (I presume this is for the dots/points) that Adobe will understand or otherwise is there a way to get this font working in Adobe?
/edit just to clarify, the text/labels/titles are all just fine its the dots that are missing for the font
/edit2 I got a working solution by just using the EPS output in ggsave, but still would love to find out a way to also be able to just open/import ggplot2 plots in PDF format directly in AI
Although changing the fonts used by AI works well, an alternative is to restrict ggplot2 from using Dingbats in the first place by adding the argument 'useDingbats' to your ggsave command eg:
ggsave(plot=p,height=6,width=6,dpi=200, filename="~/example.pdf", useDingbats=FALSE)
I ran into this problem as well on Mac OS X 10.8.2.
This resolved the issue for me:
font='/Library/Application Support/Adobe/PDFL/10.9/Fonts/AdobePiStd.otf'
cp $font /Library/Fonts/
On your system, find the file with find:
find / -name AdobePiStd.otf 2>/dev/null
/Applications/Adobe Photoshop CC 2018/Adobe Photoshop CC 2018.app/Contents/Required/PDFL/Resource/Fonts/AdobePiStd.otf
/Applications/Adobe Illustrator CC 2018/Adobe Illustrator.app/Contents/Required/PDFL Resource/Resource/Fonts/AdobePiStd.otf
/Applications/Adobe Acrobat DC/Adobe Acrobat.app/Contents/Resources/Resource/Font/AdobePiStd.otf
For dots or points that don't' display correctly in a pdf, I just substitute Zapf Dingbats for the missing font in Adobe Illustrator. For simple plot markers, this does the job most of the time.
This seems to be a perverse problem in which Adobe Illustrator cannot find a font (AdobePiStd) that is distributed with Adobe Reader and thus is likely present.
If you search your computer, you are likely to find it. On my WindowsXP system, it was in:
C:\Program Files\Adobe\Reader 10.0\Resource\Font
After finding it, you can install it and other fonts in that folder, which should enable Illustrator to find them.
For other font/pdf problems in R, the embedFonts function in grDevices package is useful.
Use useDingbats=FALSE for the pdf output, then Illustrator will no complain.
pdf("example.pdf", useDingbats=FALSE)
ggplot(plotobject, aes(x=Pos, y=Pval),res=300)
dev.off()
You can download the font AdobePiStd - just Google it, download and install. After you reboot, the font should display correctly. You can then use the 'Find Font ...' utility within Illustrator to change it if you wish.
EDIT 2018 The question under was for the initial confusion face. The answer to this question is pdf(useDingbats = FALSE) as stated in numerous answers above. I won't delete this answer, in case you want to read about fonts (which might become a problem too).
OLD ANSWER AI does not recognize Helvetica type fonts. In my computer it doesn't matter that much, since it automatically replaces the font with something suitable. Of course you'd want to change the font in some cases. I often do it manually in AI (just select all the text and change the font type). Here is a thread on how to change the font in ggplot2: Modifying fonts in ggplot2
Ps. There is also another thread that might be helpful: Fonts in R plots
Another option that in simple cases might solve the problem is to in illustrator select the textobjects not displayed correctly and change the font. Helvetica Neue works for me.
I could solve the problem just by adding alpha specification. If you don't need any transparency you can chose an alpha value of 0.9 ...
example:
ggplot() + geom_point(aes(x=..,y=.., color=...), alpha=0.8)
I am attempting to automate the insertion of JPEG images into Powerpoint. I have a macro done for that already, except using R would be infinitely better for my purposes.
The package R2PPT should do this, I understand. However, I cannot use it. For example, when I try to use PPT.Open, I understand I can do it two different ways by calling method = "rcom" or method = "RDCOMClient". Using the latter, R will always crash, sending an error report to windows. Using the former, it tells me I need to install statconnDCOM , before giving the error:
Error in PPT.Open(x) : attempt to apply non-function.
I cannot install statconnDCOM freely, as I wouldn't call this work non-commercial. So if there isn't a way to get around this issue, are there at least some free alternatives to R2PPT so that I can save several hours of manual work with a simple R code? If there is a way for me to use R2PPT, that would be ideal.
Thanks!
Edit:
I'm using R version 2.15 and downloaded the most recent version of R2PPT. Powerpoint is 2007.
Do you have administrative privileges on this machine?
There is an issue with package RDCOMClient. It needs permissions to write file rdcom.err in the root of drive C:. If you don't have privileges to write to c:, there is a rather cumbersome workaround:
Close R
Create "c:\temp" folder if it doesn't exist.
Locate on your hard drive file rdcomclient.dll. It usually placed in \R\library\RDCOMClient\libs\i386\ and in \R\library\RDCOMClient\libs\x64\ (you need to patch file which corresponds your Windows version - 32 bit or 64 bit). It's recommended to make backup copy of this files before patching.
Open rdcomclient.dll in text editor (Notepad++, for example -http://notepad-plus-plus.org/)
Find in file string c:\rdcom.err - it occurs only once.
Go into overwrite mode (usually by pressing "Ins" key). It is very important that new path will have the same number of characters as original one. Type C:\temp\e.rr instead of c:\rdcom.err
Save the file.
Now all should work fine.
Arguably not an answer, but have you looked at using Sweave/knitr to render your presentations in LaTeX using something like Beamer? (As discussed on slide 17 here.)
Wouldn't help any with getting JPGs into a PowerPoint, but would certainly make putting R-output (numerical or graphical) into a presentation much easier!
Edit: if you want to use knitr (which I recommend), here's another reference.