Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidden Lines appearing when printing wmf format from win device, during conversion of a .docx in pdf #2866

Closed
MarioClueless opened this issue Aug 28, 2018 · 6 comments

Comments

@MarioClueless
Copy link

@MarioClueless MarioClueless commented Aug 28, 2018

I'm writing to ask for an opinion about a particularly strange issue I'm facing in one of my plot exports:

i have a rather big dataset that I'm plotting. I trace the statistical median and confidence intervals of my quantities and then facet the data for each group. So far so good. The data are plotted nicely and all seems to be in order

I export the .wmf file (or just do ctrl+w in the win device of Rstudio)

for the graph (as it's the only vectorial format that can be imported in MS Word). The problem is that when I save my word file ( MS Word 2013) to a PDF format using the MS word pdf saving function, my converted file has problems for that graph.

Specifically close to 0 ( all my x , y values are positive ) there are weird lines appearing towards the left end of the data:

the x and y axis are in log10 scale. logticks_annotation does not impact the appearance of the glitch or not...

Any ideas where I would have to look at? At worst I can print a tiff image or sth like that but its quality is not remotely comparable.

I made an example of random data that reproduces the problem:
Please read in the example dataset from the excel file included and change the read path to your own :)
`
library(ggplot2)
data.in.reprex <- read.xlsx("C:/RepRex/dataset.xlsx", sheetName = "1")
y.axis.breaks <- c(1e-12,1e-11,1e-10,1e-9,1e-8,1e-7,1e-6,1e-5,1e-4,1e-3,1e-2,1e-1,1e0,1,10,1e2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15)

plotted.rand.example <- ggplot(data.in.reprex, aes(X, Y, group= Groups, colour= Operation, linetype= LineGroups)) +
geom_line(size = 0.75)+
scale_linetype_manual(values=c("solid", "dashed","dotted" ))+ # , "dotted"
scale_colour_manual(values=c("A" = "red", "B" = "blue"),
breaks=c("A", "B"))+
scale_x_log10(labels=trans_format('log10',math_format(10^.x)), breaks=y.axis.breaks, limits=c(10^(floor(log10(min(data.in.reprex$X )))),
10^(ceiling(log10(max(data.in.reprex$X)))) ))+
scale_y_log10(labels=trans_format('log10',math_format(10^.x)), breaks=y.axis.breaks, limits=c(10^(floor(log10(min(data.in.reprex$Y )))),
10^(ceiling(log10(max(data.in.reprex$Y)))) ))+
annotation_logticks(base = 10, sides = "tblr")+
labs(x = "X Quantity", y= "Y Quantity") +
facet_wrap(~Condition, nrow = 4, ncol = 2)

{windows(width = 13, height = 15)
plotted.rand.example
}`

Output:
image

dataset.xlsx

I have a similar issue with another type of plot which is a linear linear plor of 9 points in total, so I don't really see where this is coming from !

Thank you for your help !

@hadley
Copy link
Member

@hadley hadley commented Aug 28, 2018

This sort of question is a better fit for https://community.rstudio.com. Do you mind asking it over there? (You might want to read https://www.tidyverse.org/help/ first to maximise your chances of getting a good answer)

@hadley hadley closed this as completed Aug 28, 2018
@MarioClueless
Copy link
Author

@MarioClueless MarioClueless commented Aug 28, 2018

Hello,

I did but so far the few people that replied seem to be as lost as I am on this one!

Thanks,

Mario

@batpigandme
Copy link
Member

@batpigandme batpigandme commented Aug 28, 2018

Because this is occurring during the conversion from word to PDF (as opposed to pdf-generation using RMarkdown, or ggplot2 directly), I think it's out of scope for ggpot2. Also, to maximize your chances of getting help on community, I'd recommend trying to pare things down to be as minimal as possible, including using one of the methods described in reprex do's and don'ts for using built-in data,
https://reprex.tidyverse.org/articles/reprex-dos-and-donts.html
It's also much easier to read your code if you render it with the reprex package, as it takes care of code formatting for you.

@smouksassi
Copy link

@smouksassi smouksassi commented Aug 28, 2018

useful links can be :
https://stackoverflow.com/questions/28927205/weird-lines-appearing-in-the-r-graph
try to print to pdf instead of save as pdf. ( better pdf converters exist than the one shipped with office)

@MarioClueless
Copy link
Author

@MarioClueless MarioClueless commented Aug 29, 2018

Thank you both!

It is indeed a glith of the save as pdf function from Microsoft Word that I was not aware of :)

I truly appreciate the help!

@lock
Copy link

@lock lock bot commented Feb 25, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Feb 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants