All Questions
10
questions
0
votes
1
answer
479
views
set a fixed number of breaks in ggplot2 legend when plotting multiple plots
Let's suppose I have a list df of 20 data.frames and I need to plot them in a for loop using scale_fill_steps2, as follows:
plot_lst=list()
for (i in 1:length(df)) {
plot_lst[[i]] = ggplot() +
...
0
votes
1
answer
656
views
ggplot legend not showing correct typelines
I have a plot with 5 lines that are dashed, 5 that are solid. This is correctly displaying in the plot. However, using the following code, the legend shows all line to be solid. I find this strange, ...
1
vote
1
answer
36
views
Can I add a whole specific datataframe column as a legend in ggplot2?
I would like to insert a specific dataframe column (the column "labels" in the dataframe below) as part of a ggplot2 plot legend, considering that the column is not being used in the plot. I'...
2
votes
1
answer
250
views
Is there a function in R to combine two legends of a graph that's build from multiple dataframes?
I am trying to merge the legends of a plot, but I can't figure out how. I looked up many examples, but in these examples people build the plots from one dataframe. My plot is build from four ...
1
vote
2
answers
294
views
Unable to change text labels in legend box and showing up different color in legend using ggplot
My dataframe is
steps.1 interval.1 steps.2 interval.2 steps.3 interval.3
1 0 0 0 0 0 0
2 0 5 0 5 0 5
3 ...
0
votes
1
answer
62
views
How to change the legend of a ggplot
When I use ggplot and try to change the legend name from "value" to "Work schedules" doesn't change. As well the scale 0 - Did not worked; 1-Did worked. Do you know what could be wrong with my code:
...
1
vote
1
answer
2k
views
overlaying plots from different dataframes in ggplot without messing with legend
I want to overlay two plots: one is a simple point plot where a variable is used to control the dot size; and another is a simple curve.
Here is a dummy example for the first plot;
library(ggplot2)
...
1
vote
1
answer
377
views
Adding a legend to ggplot linegraph of multiple dataframes in R
I want to add a legend to a ggplot linegraph of multiple dataframes in R.
I read in several .csv files (see below) to dataframes, then plot them in R using the following code:
ggplot(data=...
0
votes
1
answer
2k
views
ggplot: Add second legend to plot with two dataframes
I have two dataframes that I can plot in a line chart with this command:
ggplot(herkunft.nach.sprachreg, aes(x=year, y=anteil, group=regio, colour = regio)) +
geom_line(size=0.75) +
#stat_smooth(...
15
votes
1
answer
10k
views
ggplot legends when plot is built from two data frames
I have data coming from two different data frames. I am trying to create legend for each data frame. I know I can combine the data frame and do it, but because of my data source it makes the most ...