I have a question about editing graphics

How can I resize a graph?

Rplotline

On the X axis I have product names, and on the Y axis I have the value of those products.
What I want to do is.

  1. that the names on the axis and be positioned vertically, for better visualization.
  2. that the graph manages to persist correctly.
    thank you very much

Hi, welcome!

We don't really have enough info to help you out. Could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

1 Like

You can successively add elements to a ggplot object. Here's an example with the built-in iris data frame.

Create a ggplot and store in an object called p

p = ggplot(iris, aes(Species, Petal.Width)) +
  geom_point()

Make x-axis labels vertical:

p = p + theme(axis.text.x=element_text(angle=-90, vjust=0.5, hjust=0))

Display the plot:

p

To save the plot at a given physical size: Here's an example of saving a plot as a PDF file with width=5" and height = 6":

pdf("myplot.pdf", 5, 6)
p
dev.off()
1 Like

Thank you very much your answer helped me a lot

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