In R how to make legend box corner round.
An example figure is:
Here legend has round shape corner and shadow.
How to achieve this in R?
I tried this:
plot(1:10, type="l")
legend("topleft", c("line"), lty=1, box.lty=1, box.lwd=2, box.col="blue")
It can change box border color but I can't find option to change the shape of box.
Related
I am trying to put a color strip legend in the top of my plot using image.plot. The command horizontal=T in image.plot put it horizontally all right but on the bottom.
Thanks
Henri
I'm using ggplot2 and ggraph to visualise graphs, but I have a problem with labels at the extremes of the x-axis. Here, labels stick out to the left and right and get clipped (see the left and right margins of the attached figure).
Is there any way to disable clipping? Alternatively, is there any way to extend the x-range based on label sizes?
I am going to change the background color of the title which is plot by gglot2, making it look like using facet. Actually, it seems I could plot just using one facet. But are there any other parameters that could change the background color of a title of a plot?
I am looking to understand why the legend on my plot is being altered when I resize the width of the plot, and how I can prevent this. Currently, I am using R.
The code I am using is this:
matplot(Year, AR4.Data[1:30,2:10], type=c("o"), pch=1, col=colorscheme, lwd=2)
legend(1998.5, 35, legend = AR4.Data[1:9,49], col=colorscheme, pch=1, cex=0.8)
Before altering the image width, the plot looks as follows:
After changing the width to 1400px, the output of the image is this:
Is there a way to ensure that the legend size is minimized when the plot width is maximized?
When making a multi-panel plot in lattice, each panel is by default bordered by a black line. I would like to be able to adjust the color and width of these panel borders. Bonus points if you can show how to add a colored border around specific panel(s).
For instance, this code makes a plot with three panels, one for each unique value of df$gears. Each panel is bordered by a black line.
library(lattice)
xyplot(mpg~hp|factor(gear), mtcars, layout=c(3,1), between=list(x=c(1))
,par.settings=list(axis.line=list(col="lightgray")))
This code almost does what I want. It changes the borders (and tick marks) of all panels to light gray. Is there a way to change the color of components independently (e.g., left and right axes)? Is there a way to address the formatting for each sub-panel independently?
Thanks,
Bryan