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
0
votes
1
answer
60
views
Learning material for R
I am looking for learning material for R (including base R & tidyverse approaches (with a focus on readr, dplyr & tidyr)) and data visualisation using ggplot2 library for commercial teaching ...
0
votes
1
answer
157
views
What is the reason behind this formula: 2 times interquartile range divided by length to the power of one third
In ggplot2 package documentation for geom_freqpoly, there is a formula in the last example which use a function to dynamically ...
0
votes
1
answer
6k
views
How to change line type in legend in ggplot in R
I have an issue with the "ggplot2"-package, where I cannot get the linetypes in the legend.
The legnd only shows the color of each line, but not the specific type.
My code looks like:
<...
1
vote
1
answer
596
views
making a contingency table with TRUE and FALSE values
I made the following contingency table already, however there should only be TRUE or FALSE and not all of them showing up on the table. How can I change that?
my code is the following:
...
1
vote
0
answers
83
views
How to plot a PCA table [closed]
I'm studying PCA method with the package PCAmixdata because I have a dataset with numerical and categorical variable. This is my example code in R:
...
0
votes
1
answer
3k
views
How to change legend labels in line plot with ggplot2?
Context: I am trying to change the legend labels for the Indices variable which contains "Positive" and "Negative" in "d_posneg" data frame.
Problem: However, my ...
2
votes
0
answers
493
views
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 ...
1
vote
1
answer
69
views
Fit non-linear customised model
I have a data.frame that have two cols, $x=mz$ and $y=res$. There are about ~2 million rows in the DF. When I plot the graph I get the below.
What I'd like to do is ...
1
vote
1
answer
220
views
ggplot2 for Cluster analysis (non-readible row names)
I have made a cluster analysis and ended up with dendrogram; however the row names are not readible (made a red rectangle). May I ask if there is way to adjust it?
...
1
vote
1
answer
183
views
Using glue to include information regarding selected observation
I would like my ggplot to display the state I had selected for better clarity but it seems like glue is only seeking for the first observation rather than my desired output.
...
0
votes
1
answer
2k
views
Plot two categorical variables against two numeric variable in ggplot
In my dataset, I have two numeric revenue features, one for each month, and two categorical features one for region and other for value segment. what I want to do is compare these two revenues col by ...
0
votes
1
answer
2k
views
How to plot a table with multiple columns as a box plot
I am trying to plot a box plot with the Trinucleotide as the x axis (so 64 trinucleotides on the x axis) and the frequency of each trinucleotide in each of 6 samples then color code the plot according ...
1
vote
1
answer
680
views
Using ggplot2 to create a bar chart [closed]
So I'm trying to create a simple bar chart of Survive vs Not Survive for the common Titanic data set in R. I keep getting just the number of No's and Yes's, and not the frequencies or counts ...
1
vote
1
answer
2k
views
How can I plot a line for time series data with categorical intervals in R
I am working with single time-series measurements that I want to plot for the time window of about 1 week.
This is the data I am working with.
This is my R script:
...
2
votes
0
answers
876
views
How to add RMSE value on a plot with ggplot [closed]
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 ...