How to avoid automatic's rotation of image ?

I have exported the following ggplot in EPS format.
Unfortunately, when I opened it, the orientation is changed to -90 degrees.
How can I avoid it?

Thanks

library(dplyr, warn.conflicts = FALSE)
library(ggplot2)



df_final=data.frame(
  annual_ratio=sample(100,100),
  rain_no=sample(100,100),
  model=rep(c("model","model2",
              "model3","model4","model5","model6",
              "model7","model8","model9","model0"),10)
  
)


P=ggplot(df_final, aes(model, annual_ratio,colour = "yy")) +
  geom_boxplot() +
  scale_x_discrete(guide = guide_axis(angle = 90))+
  theme_bw()+
  geom_boxplot(aes(x=model, y=rain_no,colour = "xx"), 
               data=df_final)+
  theme(panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        axis.line = element_line(colour = "black"))+
  theme(
    axis.text = element_text( size = 15, color = "black"),
    axis.text.x = element_text( size = 15 , color = "black"),
    axis.title = element_text( size = 15)
  )+
  theme(legend.position = c(0.82, 0.9))+
  theme(plot.title = element_text(size = 15, face = "bold"),
        legend.title=element_text(size=15),
        legend.text=element_text(size=15))+
  labs(colour= "Legend")+
  scale_y_continuous(
    "yy", 
    sec.axis = sec_axis(~ ., 
                        name = "XX")
  )
P

ggsave("Fig.eps",P,width=11, height=8.5,units = "in", dpi=300)

How about saving the file as .svg instead? This worked for me:

ggsave("Fig.svg", plot=p)

Then if necessary, using something like Cloud convert to convert SVG to EPS if you need.

thank you, @cwright1, for your response. However, I was looking for this specific EPS format.

Your issue doesnt seem reproducible as your code make a correcly oriented chart for me.
I viewed it in GIMP software that has an import .eps feature and got

what viewer do you use to see an .eps
Is it possible that that software performs a rotation ?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.