Questions tagged [ggplot2]

ggplot2 is an actively maintained open-source chart-drawing package for R, written by Hadley Wickham, based upon the principles of "Grammar of Graphics". It partially replaces R's basic plot and the lattice package, while providing a clean, powerful, orthogonal and fun API.

45 questions
11
votes
2 answers

ggvis vs. ggplot2+Shiny; which one to choose for interactive visualization?

There is a similar question here in CrossValidated, and I have read the answers. My question is a bit different. I don't want to merely visualize my data, and indeed what I want to visualize is not easy to visualize with either package. I have two…
Shahin
  • 271
  • 1
  • 9
6
votes
2 answers

Represent time-series data in much compact form

I have time series data of one month plotted day-wise as Notice every day follows a different pattern. Now, I want to show this "diversity in pattern" of each day in much compact form in a research paper. What are the different ways/options of…
Haroon Lone
  • 300
  • 1
  • 10
5
votes
1 answer

How to plot multiple columns with ggplot in R?

I do have a data frame with different categorical and numerical columns with the following schema: Id | num_col_1 | num_col_2 | num_col_3 | cat_col_1 | cat_col_2 Now I want to draw a combined plot with ggplot where I (box)plot certain numerical…
Fredrik
  • 967
  • 2
  • 9
  • 11
4
votes
1 answer

R recommendations while applying ggplot2 and plotly together to plot a graph

I have data frame having 3 columns namely index, Actual & Predicted (all column are numeric). I am using 2 packages plotly & ggplot2 for plotting index on x-axis & Actual and Predicted on y-axis. The command for plotting the graphs goes as…
Manik
  • 409
  • 3
  • 7
  • 15
3
votes
1 answer

R: lattice equivalent of density2d in ggplot?

What would be the equivalent of geom_density2d in lattice? In essence I'm trying to create this graph with lattice: I don't think contourplot or levelplot is what i want and when trying it, it gives me a blank plot?
3
votes
1 answer

Adding a trend line or horizontal mean±stdev lines in facet_grid view

Today was the final day for an On Demand event I adminned. We got some data back from the provider today. Vendors bought in at different tiers, and only one T1 was allowed because they're a sponsor. The higher the Tier number, the fewer graphics…
user208145
  • 133
  • 3
3
votes
1 answer

ggplot (in R)/matplotlib (in Python) with linear model?

How can I plot the histogram below, using ggplot (R) and/or matplotlib (Python)? In base plot I use: histogram(~ Wrkday | Year+Avg, data=Data, layout=c(3,2)) The data I work on: Code in R: Input <- (" Year Student Wrkday '1st year'…
Learner132
  • 31
  • 2
3
votes
2 answers

When Should I Use ggplot2 Instead of Tableau?

I am a student getting started with Tableau for the first time. My proficiency with ggplot2 is intermediate. I can create custom versions of the most popular kinds of charts in ggplot2 but nothing too fancy (and not very time-efficiently). I am…
SKOR2
  • 33
  • 1
  • 3
3
votes
1 answer

How to plot two distribution curves in a faceted way in R/ggplot2?

I have two probability distribution curves, a Gamma and a standarized Normal, that I need to compare: library(ggplot2) pgammaX <- function(x) pgamma(x, shape = 64.57849, scale = 0.08854802) f <- ggplot(data.frame(x=c(-4, 9)), aes(x)) +…
JulioSergio
  • 131
  • 3
2
votes
0 answers

How to add RMSE value on a plot with ggplot

I added r2 value and the formula of the regression function but I also want RMSE value on my plot, maybe I need to add something but I could not see a proper answer to this question neither here nor google... ggplot(data = AGB.rf$pred) + …
RS_girl
  • 21
  • 1
2
votes
1 answer

How to generate higher quality jpg plots on R

I have tried generating higher quality of data visualization plots from RStats. I tried increasing frame dimensions but it's still max at about ~350kb. How do I generate higher quality images from RStats?
BioIsaac
  • 23
  • 4
2
votes
1 answer

How to visualize categorical data with numeric columns

I have data like as shown below I would like to represent the above tabular data in a visual form. However, the below graph may not work because my real data as 50K unique drug names. So, is there any better way to represent this? Can you share…
2
votes
3 answers

An appropiate data visualization?

I want to include a plot in my thesis to highlight regional differences in bicycle collision outcomes. Now there are several plot visualizations I could use, and I am not sure which one could be the most appropriate. Having a "scale free" y axis…
Lutz
  • 121
  • 1
2
votes
1 answer

Mirror column plot with different y-axis in ggplot

I am trying to convert this plot Into a mirror column plot I have two datasets: school_purchases recent_school_shootings I am not very experienced with visualisation but this is my approach ggplot(school_purchases_month, aes(x = date, y =…
Ayush Ranjan
  • 401
  • 1
  • 4
  • 13
2
votes
0 answers

Graph legend for plot in Base R for class differentiated data gives incorrect representation of actual category

I am new to R. While working on my university assignments, I found that legends for Base R plot do not show correct information, hence I switched to ggplot2 wherever legends were needed. I observed although Base R color code the data (example…
Vanjuli
  • 21
  • 4
1
2 3