Skip to main content

All Questions

Tagged with
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
3 votes
1 answer
198 views

A legend marker for each unique texture in the same bar trace, with Plotly Graph Objects in Python

I have the following code as example: x=[1,2,3,4] y=[2,2,4,3] colors = ["blue","blue","orange","blue"] textures = ["","","x","...
33fred33's user avatar
0 votes
1 answer
432 views

Why does my legend not match the colour of my bars in ggplot2?

I converted the bars of my graph from gray with a coloured outline to a solid fill which resulted in half of my error bars not being visible due to being the same colour. I therefore changed the ...
e_putyora's user avatar
1 vote
4 answers
141 views

How to remove a single item from legend in ggplot

This question is related to this How to properly create this barplot in R using ggplot2? If have this code which produces this plot: library(tidyverse) df=tibble(type=c('grass','forest','desert','crop'...
TarJae's user avatar
  • 78.1k
1 vote
1 answer
180 views

Force ggplot2 to show legends (barchar and geom_line)

Easy question: I'm creating a barchart in ggplot2 with both a stacked barchart and a geom_line referring to different parts of the same dataset. No matter what I do, I'm unable to show the legends (...
Devon's user avatar
  • 27
0 votes
1 answer
243 views

Change order of legend in ggplot2

Example graph of my problem: https://i.sstatic.net/PQirh.jpg (Code at bottom) I would like to reorder my legend in a bar plot in ggplot2. Currently the fill is on a scale from "Inside", &...
OptimisticKnut's user avatar
0 votes
1 answer
701 views

How to change the width of plot legend box in R

I want to make my legend box width look like the one on the left, but instead, I got the one on the right. I couldn't figure it out. I'm new in R, what function do I need to use?
campagne probs's user avatar
-1 votes
1 answer
150 views

Barplot subplot legend python

Hello everyone how can i make legend for 3 different bar color that code with subplot? Data frame: This is my code: fig,axs = plt.subplots(2,3, figsize=(30,20)) axs[0,1].bar(x = df_7_churn_tenure['...
Jovian Aditya's user avatar
0 votes
1 answer
527 views

Why the labels under chart are not corresponding with labels in legend in Chart.js for bar chart?

I would like to make a chart with labels on xAxes and the same labels in the legend. I was trying different solutions, but the best I got is the snippet below. I don't understand, why all bars are ...
Kida's user avatar
  • 800
1 vote
1 answer
773 views

How to align a single legend over two seaborn barplots?

I would like to have a single legend that nicely fits on top of both the subplots (doesn't necessarily need to span the entire width of the plots, but needs to be outside the plot). I know you can ...
JonnDough's user avatar
  • 887
3 votes
1 answer
2k views

Placing a Legend Title Above a Horizontal Legend Already Positioned at the Top of a Barplot ggplot

Issue: I have done a lot of research and tried many different solutions and I could not find an answer to my problem, at least not one that worked for me. I am attempting to place the legend title '...
Alice Hobbs's user avatar
  • 1,043
0 votes
1 answer
1k views

How to plot a barplot with different hatch and edge color with legends using matplotlib?

I would like to plot a barplot where bars have a different hatch and edge color using Matplotlib with its proper legends. I tried to plot but I couldn't generate proper legends with this code: import ...
Kamran Ansari's user avatar
1 vote
1 answer
379 views

adding a legend to a barplot at he top left

barcols <- c("green","red","purple") barcols barplot(table(gender$Alert.Level, gender$Gender),las=1, beside= TRUE, ylab= "Frequency", xlab="gender"...
John Williams's user avatar
0 votes
0 answers
78 views

Troubles with pyplot.bar legend

I'm having troubles introducing a legend in this chart. Can someone help me? I can plot the chart but everytime I try to apply a legend it doesn't work.. flags=['0','1','2','3','4','5'] ...
GLTCL's user avatar
  • 13
0 votes
1 answer
99 views

How to add legends to the barplot in R like shown in the below image?

I want to implement legend like tjhis
user18053372's user avatar

15 30 50 per page
1
2
3 4 5
8