See the help for legend
:
The location may also be specified by setting x to a single keyword from the list “bottomright”, “bottom”, “bottomleft”, “left”, “topleft”, “top”, “topright”, “right” and “center”. This places the legend on the inside of the plot frame at the given location.
So you can place the legend outside the plotting region by giving its coordinates manually:
legend(-0.2, 0.3, legend = c("apple", "orange", "tree"), bty = "n", xpd=TRUE, mar=c(7,7,7,7), cex = 1, pch = c(10, 15, 1))
Related Posts:
- How to increase font size in a plot in R?
- Code to clear all plots in RStudio
- What is the difference between importing matplotlib and matplotlib.pyplot?
- How do you change the size of figures drawn with Matplotlib?
- Save plot to image file instead of displaying it using Matplotlib
- How to plot ROC curve in Python
- Matplotlib automatic legend outside plot
- Replace a value in a data frame based on a conditional (`if`) statement
- How to read in .HTM into R as a data frame?
- How to randomize ggplot factor color scheme, keeping same default distances on color wheel?
- Count number of occurences for each unique value
- Find duplicate values in R
- Transpose a data frame
- ggplot geom_text font size control
- What’s the difference between lapply and do.call?
- ggplot2, change title size
- Initial value in ‘vmmin’ is not finite even when changing the starting value
- Insert picture/table in R Markdown
- Test if a vector contains a given element
- How to remove outliers from a dataset
- How to make a 3D scatter plot in matplotlib
- Insert a blank column in dataframe
- “length of ‘dimnames’ [2] not equal to array extent” on one of two very similar sets
- Mean per group in a data.frame
- How to install RHadoop packages (Rmr, Rhdfs, Rhbase)?
- Modify the legend of pandas bar plot
- Changing the “tick frequency” on x or y axis in matplotlib
- When to use cla(), clf() or close() for clearing a plot in matplotlib?
- Error in dev.off() : cannot shut down device 1 (the null device)
- Remove xticks in a matplotlib plot?
- standard deviation on dataframe does not work
- Warning message: In `…` : invalid factor level, NA generated
- What is the difference between = and ==?
- Merge r brings error “‘by’ must specify uniquely valid columns”
- promise already under evaluation: recursive default argument reference or earlier problems?
- What does the error “arguments imply differing number of rows: x, y” mean?
- Aggregate multiple columns at once
- Error in model.frame.default: variable lengths differ
- Non-numeric argument to mathematical function
- Position-dodge warning with ggplot boxplot?
- Plot two graphs in same plot in R
- R – Concatenate two dataframes?
- KNN in R: ‘train and class have different lengths’?
- Error in rep(1, n.ahead) : invalid ‘times’ argument in R
- Producing subscripts in R markdown
- Set the intervals of x-axis using r
- R multiple conditions in if statement
- How to avoid “Error in stripchart.default(x1, …) : invalid plotting method” error?
- Remove quotes from a character vector in R
- Simple manual RMarkdown tables that look good in HTML, PDF and DOCX
- Select rows from a data frame based on values in a vector
- dplyr: “Error in n(): function should not be called directly”
- how to increase the limit for max.print in R
- In R formulas, why do I have to use the I() function on power terms, like y ~ I(x^3)
- Filter data.frame rows by a logical condition
- Replace NA with 0 in a data frame column [duplicate]
- How to plot 3D scatter diagram using ggplot?
- How do I convert a factor into date format?
- Error while creating heatmaps – NA/NaN/Inf in foreign function call (arg 11)
- Write lines of text to a file in R
- Plotting multiple lines, in different colors, with pandas dataframe
- Conditional mean statement
- Warning in GLM analysis
- What does ‘length of ‘dimnames’ [1] not equal to array extent’ mean?
- How do I flip rows and columns in R
- Plotting of 1-dimensional Gaussian distribution function
- Print string and variable contents on the same line in R
- “no function to return from, jumping to top level”
- Does R have a wildcard expression (such as an asterisk (*))?
- Simple for loop in R producing “replacement has length zero” in R
- Removing punctuations from text using R
- How to find out which package version is loaded in R?
- How to solve it. error:Error in data[[rowvar]] : attempt to select less than one element
- How to melt and cast dataframes using dplyr?
- How to unload a package without restarting R
- use first row data as column names in r
- plotting package for c++
- What is the difference between require() and library()?
- Launching R help: Error in file(out, “wt”) : cannot open the connection
- Reset par to the default values at startup
- How to increase the font size of ggtitle in ggplot2
- Error in G * t(hat) : non-conformable arrays
- Error: isTRUE(gpclibPermitStatus()) is not TRUE
- How to counter the ‘non-numeric matrix extent’ error in R?
- What does is.na() applied to non-(list or vector) of type ‘NULL’ mean?
- error r: invalid subscript type “closure” in a simple regression
- Merge two rows in data.frame
- Get the list of installed packages by user in R
- How to access the last value in a vector?
- Mask output of `The following objects are masked from….:` after calling attach() function
- Construct a manual legend for a complicated plot
- Error: x must be atomic for ‘sort.list’
- Installing R on Android
- Transposing in dplyr
- Does the c command create a row vector or a column vector by default in R
- XY Plotting with Java
- KeyError: ‘plotly_domain’
- Converting from a character to a numeric data frame
- How to create lag variables
- When trying to replace values, “missing values are not allowed in subscripted assignments of data frames”