### How to set limits for axes in ggplot2 R plots?

I plot the following: library(ggplot2) carrots <- data.frame(length = rnorm(500000, 10000, 10000)) cukes <- data.frame(length = rnorm(50000, 10000, 20000)) carrots$veg <- 'carrot' cukes$veg...

I plot the following: library(ggplot2) carrots <- data.frame(length = rnorm(500000, 10000, 10000)) cukes <- data.frame(length = rnorm(50000, 10000, 20000)) carrots$veg <- 'carrot' cukes$veg...

How can I move a ggplot2 legend to the bottom of the plot and turn it horizontally? Sample code: library(reshape2) # for melt df <- melt(outer(1:4, 1:4), varnames = c("X1", "X2")) p1 <- ggplot(df,...

Is there an easy way to increase the space between the plot title and plot area below it (i.e., the box with the data). Similarly, I'd prefer to have some space between the axis title and axis...

I have the following plot like below. It was created with this command: library(ggplot2) df <- data.frame(cond = factor(rep(c("A", "B"), each = 200)), rating = c(rnorm(200),...

I'm trying to figure out how to use downloadButton to save a plot with shiny. The example in the package demonstrates downloadButton/downloadHandler to save a .csv. I'm going to make a...

The data I'm playing with comes from the internet source listed below nba <- read.csv("http://datasets.flowingdata.com/ppg2008.csv", sep=",") What I want to do, is create a 2D points graph...

While trying to overlay a new line to a existing ggplot I am getting the following error: Error: ggplot2 doesn't know how to deal with data of class uneval The first part of my code works fine. ...

Using geom_text to label outlying points of scatter plot. By definition, these points tend to be close to the canvas edges: there is usually at least one word that overlaps the canvas edge,...

I have thousands of points in one figure and set the "size = 1". However the point size in the legend is reduced too. How to increase the point size in the legend? For example. num <-...

Once upon a time, I changed my ggplot2 font using using windowsFonts(Times=windowsFont("TT Times New Roman")) to change it. Now I can't get it off of this. In trying to set family="" in ggplot2...

This may seem like a stupid question, but I am a little confused. It seems that the code I wrote and tested last week has now suddenly decided to change the output even though nothing in the code...

So far, I have managed to visually present data for different socio-economic factors at a district level in Pakistan with the help of the tmap package to create the following...

library(cluster) km.res <- kmeans(my_data, 4, nstart = 25) # Visualize library("factoextra") fviz_cluster(km.res, data = my_data, frame.type = "convex")+ theme_minimal() I would like to change...

I am using this factoextra package in R to do Correspondent Analysis. When I print out the result plot, I can't find the option to hide the x and y zeroline. I know that the theme setting is...

Hi I usually use some code like the following to reorder bars in ggplot or other types of plots. Normal plot (unordered) library(tidyverse) iris.tr <-iris %>% group_by(Species) %>% mutate(mSW =...

In order to show specific features from the results of my PCA (with FactomineR), I am trying to manipulate the plot of individuals and the biplot with the factoextra package. I want to draw...

I'm trying to obtain the matrix (Ordered dissimilarity matrix) from the ggplot that is generated with the function fviz_dist from factoextra package. From my original data I generated a distance...

I'm new to R and am attempting to cluster some data based on industry. I have learned that K-means cannot handle factors and categorical data. I have removed the factor called 'Industry' -- 67...

I made a scattershot with ggplot2 and I mapped a binary variable to point size. The result was satisfactory but I got the warning "Using size for a discrete variable is not advised". I understand...

I have the dataframe below...

I am trying to combine (in a single chart) a regular ggplot chart with a table obtained with flextable. Consider the following example: library(tidyverse) library(patchwork) mydf <- tibble(a =...

I would like to insert new coordinates in my scatterplot, from another matrix. I am using the fviz_cluster function to generate the graph for the clusters. I would like to insert the coordinates...

Does anyone have any suggestions on how to export the values from your kriged data in R. I have them exported as a raster, but I need the actual cell values. The data that I'm working with are...

I used to run this code all the time to get the sum of 'n' at the top of my bar chart. Now I get the follow errors: Ignoring unknown parameters: fun.y No summary function supplied, defaulting to...

the problem i am trying to solve is that i want to extract the value of pixels of multiple rasters using a shapefile containing multiple point locations , for each point i would like to extract...

I am building a plot with ggplot. I have data where y is mostly independent of X, but I randomly have a few extreme values of Y at low values of X. Like this: set.seed(1) X <- rnorm(500, mean=5) y...

I am having some trouble setting up my data for some point pattern analysis. What I want to do: conduct a point pattern analysis on NYC arrest data and see if there exists a spatial dependence...

I have the following R code: library(factoextra) kms<-kmeans(df,18,nstart=100) fviz_cluster(kms, data = df, alpha=0.2,shape=19,geom = "point") It outputs the following picture: Is possible...

I want to create a clickable histogram in shiny but I don't know if it is possible. Some months ago I saw a clickable volcano plot which gives you a table of what you click. Source:...

I was wondering if anyone knows a way to combine a table and ggplot legend so that the legend appears as a column in the table as shown in the image. Sorry if this has been asked before but I...