Save plot with high resolution without using ggsave

Hi, I would like to know if there is a way to save the following plot with high resolution, and personalised size? For example the width and height of the plot? I know ggsave works best when working with ggplot, but I didn't make use of ggplot to plot the graph this time.

Here is my script:

axis(1,at=1:length(Group), label=Group)
lines(e06240,col="red",type = "l",lwd=2)
lines(e05438,col="blue",type = "l",lwd=2)
lines(e07093,col="pink",type = "l",lwd=2)
lines(e09399,col="purple",type = "l",lwd=2)
lines(e02357,col="yellow3",type = "l",lwd=2)
lines(e05394,col="green",type = "l",lwd=2)
lines(e06708,col="orange",type = "l",lwd=2)
lines(e04979,col="magenta",type = "l",lwd=2)
lines(e11816,col="midnightblue",type = "l",lwd=2)
lines(e04738,col="navy",type = "l",lwd=2)
lines(e08386,col="mediumorchid1",type = "l",lwd=2)
legend("topright", legend=c("e02871","e06240","e05438","e07093","e09399","e02357","e05394","e06708","e04979","e11816","e04738","e08386"),
lty=1,lwd=2,pch = 21,col = c("black","red","blue","pink","purple","yellow3","green","orange","magenta","midnightblue","navy","mediumorchid1"),
ncol=4,bty = "n", cex = 0.6,
text.col = c("black","red","blue","pink","purple","yellow3","green","orange","magenta","midnightblue","navy","mediumorchid1"),

Hi, why didn't you try ggplot?

ggplot(data=df, aes(x=xvar, y=yvar)) + 

ggsave(path = path, width = width, height = height, device='tiff', dpi=700)

Try this!

Hi, I did try ggplot, but I want to specify the colours of the lines? Not sure how to do that in ggplot..

Here is my ggplot script:
ggplot(data = green_data2,
mapping = aes(x = Groups,
y = as.numeric(value),
group = peptide)) +
geom_line(aes(color = peptide)) +
scale_y_continuous(expand = c(0,0),
limits = c(0,14)) + #set limits according to min and max
labs(title = "Comparison of peptide levels between groups",
x = "Groups",
y = "Peptide levels",
color = "Peptides") +
base_size = 9,
base_family = "",
base_line_size = base_size/18,
base_rect_size = base_size/18) +
theme(legend.position = "bottom", legend.direction = "horizontal")

d <- ggplot(df, aes(x=x, y=value, group=variable, colour=variable ) ) + 

d+ scale_color_manual(values=c("#CC6666", "#9999CC"))

Try this..

O yes, great this works! Thank you!

1 Like

Glad, it worked.

Kindly favor me by marking it the solution :slight_smile:

This topic was automatically closed 7 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.