Skip to main content

All Questions

Tagged with
28 questions with no upvoted or accepted answers
3 votes
0 answers
2k views

Theme(position.legend="none") doesn't work with coord_flip()

I want to have a horizontal bar chart, but without legend. When I run the script below without coord_flip(), no legend shows. But when I run it with the coord_flip() argument, the legend appaers. I ...
SHW's user avatar
  • 491
1 vote
0 answers
30 views

Why is the coding for legend on my barplot not working after update?

I updated Rstudio and suddenly none of my legends are working on my barplots. It's my first time asking for help on here, so hopefully I am providing the info needed to get answers? Coding is below. ...
Rebecca Connor's user avatar
1 vote
0 answers
131 views

How to add space between Legend text and chart in ChartJs v4

I'm using Chart.js version 4.4.1, and I want to increase the space between the legend and the chart. I need a solution for barchart. I'm sharing the code for the bar chart. I've checked several posts, ...
Aishwarya's user avatar
1 vote
0 answers
220 views

ChartJS Stacked Bar Chart Display Stack Names in Legend

I have a stacked bar graph and wish to divide the data labels in the legend into groups based on the stack id/name to which they relate by including the stack id/name as header for each group of ...
dickey's user avatar
  • 21
1 vote
1 answer
31 views

How to set the of items in legend and plot with dataframe bar plot

I would like to change the order of bars and legend in the following figure.Bar plot I would like to have the order of High, Medium, low in the legend from up to down and in the plot from left to ...
shayan's user avatar
  • 11
1 vote
0 answers
791 views

How do I match the order of a legend to the order in a bar chart?

I made some lovely bar charts with the basic plot function in R. However, my boss told me she would like them done in ggplot using colorbrewer colors. Well, 2 days later, I finally made the ...
Matthew Aldrovandi's user avatar
1 vote
1 answer
260 views

Changing location of legend and size of bar plot

Ive created grouped by data by Age groups and gender and plotted it But I can`t seem to find a way to change to location of the legend This is my code: purchase = ds.groupby(['Age','Gender'])....
Lena Meer's user avatar
1 vote
0 answers
3k views

Error in strwidth(legend, units = "user", cex = cex, font = text.font) : plot.new has not been called yet

I can't get the legend for my barplot to appear. table1b <- table(mydata$SEX, mydata$CLASS) addmargins(table1b) colorSex <- c("lightpink", "gray", "lightblue") barplot(table1b, beside = TRUE, ...
anreneer's user avatar
1 vote
1 answer
271 views

Incomplete visualization of legend with barplot() in R

I'm trying to make a stacked barplot but the legends either overlap the bars, thus making it impossible to see them, or become incomplete when I use args.legend() to move them to the right: barplot(...
cgog's user avatar
  • 53
1 vote
0 answers
197 views

Custom Bokeh Legend for Bar Graph

In bokeh, I created a Bar chart of genes vs some metric a (it doesn't matter what the y-value is), but I would like to color the bars by some metric b (again, doesn't matter). This is very doable by ...
ericmarkmartin's user avatar
1 vote
0 answers
1k views

How to set the size of a legend in a barplot in R?

I have created a grouped bar chart using barplot in R. Unfortunately, the legend appears abnormally huge and even gets cut off, as you can see from the figure. Here is the code I have used. # data: #...
Nonancourt's user avatar
0 votes
0 answers
29 views

How to plot the legend with combined_plot (ggplot2)

I created this script to display some environmental impacts for my research. `legend_plot <- ggplot(data_longGW, aes(x = Crop_cycleGW, y = kg_CO2_eq, fill = Category)) + geom_bar(stat = "...
Guido Evangelista's user avatar
0 votes
1 answer
34 views

Legend of the library Fantaxtic

I am running the library fantaxtic in R studio. I want to make a bar chart or something like that. However, in the legend I don't want any title in the legend and the category Other is located at the ...
user1892205's user avatar
0 votes
0 answers
34 views

Same scale in legend for circular bar plot

Building on this post and code (with reproducible example) Different fill color for negative values in circular barplot, I want to plot two of these figures together as a comparison, like this: But ...
MoonS's user avatar
  • 175
0 votes
1 answer
59 views

ggplot2: Legend with barplot and line

I am trying to produce a graph that shows averages by decile of two variables (as they have very different values, I added a second y-axis). On variable is represented with bars, the other one with a ...
Antoine D's user avatar

15 30 50 per page