Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [legend]

A graph legend is commonly used when plotting several sets of data within the same diagram. The legend associates each plot with its corresponding data.

0 votes
2 answers
37 views

ggplot2 legend not appearing

I'm having trouble producing a legend for my ggplot2 figure of categorical point data with a bar indicating the mean overlaid on top. plot <- ggplot(df, aes(tree, o18)) plot + geom_point() + ...
Lmack101010's user avatar
1 vote
1 answer
26 views

Avoid vlines groups to appear in legend

I want to make a line plot with custom colors and additional vlines with custom colors too. It all works well except I cannot find a way of removing the vline groups from the legend... after checking ...
DaniCee's user avatar
  • 2,859
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
1 vote
1 answer
81 views

plotly title_side position not working properly

I'm greenhand with Python plots but I was trying to do a PCA for different human populations; while I'm still working on the actual data, the main issue I'm having with visualizations in Python, as ...
Matteo's user avatar
  • 209
1 vote
1 answer
35 views

remove one legend entry in legend of dendrogram

I am experiencing issues with the legend entries of a dendrogram. I am utilizing the code example provided here. library(ggplot2) library(ggdendro) library(plyr) library(zoo) df <- USArrests ...
Excelsior's user avatar
  • 181
1 vote
0 answers
80 views

amCharts (5) Force-Directed Tree legend background transparent (overlaps content unnecessarily)

Problem: When using a Legend in a Force-Directed Tree, it overlaps content unnecessarily. How can I make the background transparent? Demo: https://codepen.io/DavidDunham/pen/KKEeMPX (the code snipped ...
DavidDunham's user avatar
  • 1,320
1 vote
1 answer
186 views

How to make a legend with line and markers with different fillstyles?

I am unsure of how to reproduce the following lines/marker combination in matplotlib: Note that the legend has both the line and the marker correctly. The best I could find in the matplotlib ...
Idieh's user avatar
  • 63
0 votes
1 answer
398 views

how to add a legend to streamlit folium map when there is few discrete colors

How to add a Legend to a folium map when the color scale is like this: color_scale = { 'Category - 1': 'green', 'Category - 2': 'yellow', 'Category - 3': 'orange', 'Category - 4': 'red'...
Nirmal Sankalana's user avatar
1 vote
1 answer
58 views

How to make Matlab legend show opaque plot symbols when scatter plot symbols are semi-transparent in the figure

I am trying to create a scatter plot cloud, of which I set the points are all "filled" and semi-transparent by setting "MarkerFaceAlpha=0.1". However, when I export the legend ...
Kevin's user avatar
  • 29
-1 votes
1 answer
117 views

Cannot Rotate Legend Horizontally in GeoPandas

I am trying to plot California counties and color them by their FIPS code. The sample code from the GeoPandas website is: chicago.plot( column="POP2010", legend=True, ...
ZacharyST's user avatar
  • 676
0 votes
2 answers
93 views

Rearrange Legend in SAS

Legend is automatically alphabetical, and I would like to place the "No Data" category after the categorical Quartile Range. proc gmap data= library.df map= library.vafips all; id fips; ...
Alexandra's user avatar
0 votes
1 answer
61 views

SciChart: Move SciChartLegend to separate part of application

Sorry if it look like a duplicate of question asked on SciChart forum https://www.scichart.com/questions/wpf/move-settings-from-legend-to-separate-menu but I didn't found the solution yet. Maybe I ...
Fedor Yudin's user avatar
0 votes
0 answers
218 views

Legend with ggplot and geom_sf

I have built a map of Toulouse using ggplot and geom_sf for having only the elements I want, eg. main roads, river, railways, ... Then I need to plot the n bike stations, each one colored with the n ...
Bertrand Jouve's user avatar
3 votes
1 answer
72 views

Sharing multiple ggplot legend symbols with one label

I am trying to create a stacked barplot for one response over time (Year) across 3 different sites that I've separated into different facets (facet_wrap). I would like different colours per facet, and ...
James White's user avatar
0 votes
1 answer
60 views

Multiple column legends in Matplotlib

I created a single stacked horizontal bar chart which illustrates the values in a (normalized) series using: data = df['state'].value_counts(normalize=True).to_frame() data.T.plot.barh(stacked=True, ...
vonbecker's user avatar
2 votes
1 answer
60 views

Seaborn heatmap legend disturb the plots order with subplots

I have 2 dataframes like this: df1 = pd.DataFrame(np.random.randint(0,50,size=(5,5)), columns=list('ABCDE')) df2 = pd.DataFrame(np.random.randint(0,50,size=(5,5)), columns=list('FGHIJ')) I want to ...
Yash's user avatar
  • 337
0 votes
0 answers
83 views

How I make the arrows to be same, but represent a trend in R ggplot?

I need my map to look like this: But now it only shows shows the colour of an arrow and the legend is comletely wrong Dataframe: instorks_trends <- data.frame( Country = c("Portugal", &...
user22887359's user avatar
1 vote
1 answer
32 views

Changing Legend in ggplot2 in R

Here is an example dataframe: Tag/Percentage/type A 0,3 1 E 0,4 1 F 0,5 2 F 0,6 2 G 0,5 3 T 0,2 3 H 0,1 4 I'm trying to plot the ...
Miga's user avatar
  • 31
1 vote
1 answer
205 views

Combine catplot legend with other legends in seaborn

I want to combine multiple plot legends with a catplot legend and place the single result in the upper right. I also want to replace the labels on both. Examples - {"avg tip":"average&...
ciaran haines's user avatar
3 votes
1 answer
131 views

Custom legend for the plot with lines changing colour

I want to plot two error bars plots with lines changing colour, one going from pink to blue, and another from blue to pink. I did not find a way to do this with plt.errorbar(), but managed to find a ...
Lidiia's user avatar
  • 33
2 votes
2 answers
55 views

Legend showing wrong color in ggplot geom_sf

I am making a map where I need some cities to be points of a certain color (A cities) and some cities to be points of a different color (B cities). All B cities are also on the A list so I put the B ...
Alyssa's user avatar
  • 23
1 vote
1 answer
237 views

Legend for contourf in matplotlib [duplicate]

Is there a way put a legend for a contourf plot in matplotlib? In matlab it's possible to put one like the example picture shown below. I am aware of both these questions posted previously: How do you ...
albo's user avatar
  • 33
0 votes
1 answer
652 views

Pheatmap in R: Setting Fixed Limits of Heatmap Legend

I am working in R with the pheatmap library. I am creating heatmaps for different timepoints for the same population, so I want the legend scale to be fixed (from -2 to 2) for each heatmap so they can ...
Torie Duke's user avatar
0 votes
0 answers
4 views

Misconfigured legends

I use the following script and I obtain a missconfigured legends. Do you know the reason? barplot(x, main="Especies y Grupos", beside=TRUE, col=c("red","green3","...
Cristóbal León-Salas's user avatar
0 votes
3 answers
44 views

Separated legend between two variables in ggplot

I have a dataframe which look like this : From it, I want to make a plot which look like this : I used ggplot and LibreOffice Draw to make the above plot. I wish to use ggplot only. Here is a ...
armandfavrot's user avatar
0 votes
0 answers
20 views

Creating custom legends in ggplot? [duplicate]

I have a data set that I add multiple layers to the original data and colors for this information. I want to highlight specific plots on the graph and add those to a legend. From what I have found I ...
wchristensen1024's user avatar
0 votes
2 answers
222 views

How to reverse order of legend for horizontal stacked bar chart in seaborn?

I have the following code that generates a horizontal stacked bar chart in python, using seaborn. sns.set_style('white') ax = sns.histplot( data=temp, y='tmp', weights='Weight', hue=field, ...
LostinSpatialAnalysis's user avatar
0 votes
1 answer
41 views

Changing Title of Legend in ggplot2 Creates a Second Legend?

I am pretty new to R/working with data and am trying to change the title of the legend in a visualization I made. I have tried using fill= in the labels() function I have but it adds another legend ...
aoao's user avatar
  • 3
1 vote
2 answers
62 views

matplotlib scatter plot legend not dependent on the colour of the point

I want to make my legend to the scatter plot not dependent on the colour of the point. The simple example is below: import matplotlib.pyplot as plt import numpy as np import pandas as pd fake_data = ...
Wiktoria's user avatar
1 vote
2 answers
320 views

Customize legend with discrete labels for heatmap with continuous but binned data

I have created a heatmap in ggplot with continuous temperature data and scale_fill_viridis_c: To make it easier to read I am testing a binned version with scale_fill_viridis_b and n.breaks: My ...
Martin Liungman's user avatar

15 30 50 per page
1
3 4
5
6 7
173