I would like to plot the results from a quantile regression, but am not able to:
Here is my code:
require(quantreg) data(engel) attach(engel) xx <- income - mean(income) zz <- c(120, diff(income)) fit1 <- summary(rq(foodexp~xx+zz, tau=2:98/100))
Then:
png('res.png') plot(fit1, mfrow=c(1,2))
Only the zz plot is saved to the res.png file.. Is there any way I can save the plots in separate files (two and one)? and how do I control the width/height of the plots? I like all the individual plots to have width=height (square) when i save them to the .png file?
To resize the image, use image_scale() function. where value is either relative to parent object or fixed size values. Value = 100% or 500 or 200%, etc.
In base R, we can save a plot as a png and pass the resolution in the same stage. The procedure to do this is creating the png image with resolution with res argument then creating the plot and using dev. off() to create the file.
Under Windows, right click inside the graph window, and choose either "Save as metafile ..." or "Save as postscript ..." If using Word, make sure to save as a metafile.
You can control the image dimensions by png
argument.
png("image.png", width = 800, height = 600) plot(...) dev.off()
To "finish" the image, use dev.off
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With