ggplot2

How to plot multiple charts on an A4 sheet with defined margins?

To illustrate the question I have considered the hypothetical situation below, using the libraries ggplot2 and gridExtra. l ... de by side in two columns 0.5 cm apart between a grid of 3x2; the size of the title fonts is 12 and the subtitles are 10.

Bar chart - ggplot2

I have a data-frame with the structure below. I want to make a simple bar chart that relates the " CID " by Type (A, B, C, et ... ENTOS)) + geom_bar() That returned me: Error: stat_count () must not be used with a y aesthetic. Thank you very much,

Bar chart with percentages - ggplot2

v1 = c("Sim","Não","Não","Não","Não","Sim","Sim","Sim","Sim","Sim") v2 = c("branco","branco","pardo","preto","pardo","pardo", ... + labs(y = "Percentual",x="Raça/Cor")+ facet_grid(.~v1) But it is not totaling 100% within each category of v1. Any help?

I want to generate a table from R to Latex

I want to generate a table with the R summary data with the results I got, I know it has a library called stargazer that does, but I couldn't find the documentation.

Rmarkdown aggregate error

Hello, I am trying to create reports by Rmarkdown, with the method read_chunk() it is possible to plot in doc using script ou ... tor")), .Names = c("Dia", "Meta.X", "X._Resolvidos", "X._Resolvidos_no_X"), row.names = c(NA, -28L), class = "data.frame")

Quadratic curve estimation minimums Square using R

I have a quadratic model that I want to run a simple multivariate regression using Ordinary Least Squares. This Is My Code: ... on the scatter plot (y - x). How do I do that? When I do: plot(regression) I don't have that option. Any help? Thank you!

Creating BoxPlot in ggplot2

I'm doing some simulations on R. When generating a data.frame and requesting printing of boxplots with small sample size and ... limits=c(-0.5, 2))+ theme(plot.title = element_text(hjust = 0.5)) library(gridExtra) grid.arrange(g1,g2, g3, g4)

How to put values in bar charts with facets in R?

I'm trying to generate a faceted bar chart with R, as per data frame and commands below: ############################### ... aph becomes disfigured, with values outside the bar and the variable y going up to 200. What's wrong? From now on I thank

Stacked bar chart - labels and sorting - GGPLOT

I am building a graph indicating the population of the Brazilian states, organized by regions, according to the code below: ... r, even ordering the date.input frame, I couldn't do this visual sort in ggplot. Can anyone help me? Thanks for the support!

Draw lines from a specific point and angle

I'm looking for a way to draw a line from a point and an angle (azimuth) and then construct a polygon with the intersection o ... value to ensure that they intersect. The ultimate goal is to create a Polygon created from the intersection of the segments.

How to change the font on a chart in R?

I want to use use font Times New Roman in the graph, but R/Rstudio returns an error message saying Do not find it. Obviousl ... #> withr 2.1.0 2017-11-01 CRAN (R 3.4.2) #> yaml 2.1.14 2016-11-12 CRAN (R 3.4.0)

LineType and shape in ggplot2 in R

I am using the following code to plot 3 functions: ggplot(data.frame(x = c(0, 2)), aes(x)) + stat_function(fun = exp, g ... le, asterisks and points) can be any (square, circle ...) . How do I add a caption with the respective shapes for each line?

gradient color R

How do I change the color of the graph gradient with the variable years, starting from white to deep red. colourCount = len ... julho", "agosto", "setembro", "outubro", "novembro", "dezembro")) theme(axis.text.x = element_text(angle = 90, hjust = 1))

Ggplot2 boxplot giving error (does not make boxes, only a few points with some risks), how to fix? Note: I made other graphics and it worked out, only this one packed

boxef <- ggplot (effectsize, aes(subordemfam, varbiom.efs, colour = classe2)) boxef + geom_point() + geom_boxplot() + ... the effect size values on the vertical axis. My dataframe is correct, having been successfully used in making other charts.

How to plot multiple charts on multiple different pages using ggplot

I have the following data frame (df): Subject Period Treatment Time Concentration 1 1 1 ... s possible to be done in an elegant way with few lines of command? Thank you very much and all help will be very welcome.

How to make forecast charts in R?

I have a model that makes predictions and would like to plot the observed series and then the predictions, according to this ... ") %>% ggplot() + geom_line(aes(x = date, y = confirmed)) + geom_line(previsoes, aes(x = Data, y = Previsao_Casos))

Confidence interval using ggplot2

How to include 95% confidence interval in chart columns using ggplot2? Data frame I'm using x<-c(0.005, 0.178, 0.031, 0.0 ... tity", aes(fill=y>0), width = .8)+ ylab("y")+ xlab("x")+ theme(axis.text.x = element_text(angle = 90, vjust = 0.6))

Coloring specific points in Ggplot-R

I'm doing a graphical analysis of the data from the gapminder package. Soon, I made the following code: library('gapminder' ... chart below: However, I want to color with the green color the points referring to Brazil. How can I do this? Sincerely.

How to insert subtitle of points and lines in ggplot?

How do I insert the dots in the caption? The purple dot on the caption "base1" and the red dot on the caption "base2"? lines ... 003c30"), guide = guide_legend(override.aes=aes(fill=group))) + theme(legend.position=c(0.1, 0.1))

Reorder the columns of a bar chart and its legend

When processing and plotting data in R using tidyverse, it by default leaves the order of the chart bars in the original orde ... ed x-axis legend. I ended up not fixing this in my example, but the final version of the chart will have this problem solved.