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.

1 vote
1 answer
40 views

ggplot of multiple geom_sf datasets gives mismatched legend colours

I am trying to create a ggplot map which includes two simple feature line datasets. I would like the lines to either appear in the same legend, or a separate legend. However the approach I am taking ...
0 votes
1 answer
31 views

Is it possible to count the occurrence number of a custom icon in Leaflet? If yes, how to do it?

Firstly, I'm a beginner, I've learned a lot from you. I have 5 custom icons defined: //Awesome icons var LeafIcon = L.Icon.extend({ options: { shadowUrl: "markers-shadow.png", ...
1 vote
2 answers
51 views

adjusting the legend in TramineR plots

I am new to using TramineR and I just cannot seem to figure out how to arrange the legend in any of the plot types. The legend keeps being cut off by the plots. I have tried to use the seqlegend ...
0 votes
0 answers
28 views

Having problem adding legend onto my ggplot when ggplot's data argument is NULL [duplicate]

New to r here, so please bear with me. I am sure this is something simple to solve. I have this plot here and want to add a legend to distinguish which line represents the "Tailwater Gauge" ...
2 votes
1 answer
35 views

Rotating/angle of ggplot key_glpyh, custom legend key glyph

I am trying to emulate a plot style ive seen online, created by Chris Canipe (https://www.axios.com/2017/12/15/the-flow-of-goods-between-states-1513304375). Looking at trade flows, I've managed to ...
1 vote
2 answers
43 views

Altair chart legend for subset of data

As an exercise for learning more advanced altair, I'm trying to generate a simplified version of this chart: https://climatereanalyzer.org/clim/t2_daily/?dm_id=world. To simplify, I'm using gray for ...
0 votes
1 answer
28 views

Plant UML Multiple legend in Gantt View

How to add Multiple legend with different colors in Gantt Chart using Plant UML? It's working for me, for one legned. It's taking the last line of code... Is there a way to show, different parameter ...
519 votes
9 answers
1.0m views

How to change legend fontsize with matplotlib.pyplot

Simple question here: I'm trying to get the size of my legend using matplotlib.pyplot to be smaller (i.e., the text to be smaller). The code I'm using goes something like this: plot.figure() plot....
222 votes
11 answers
452k views

Plot a legend outside of the plotting area in base graphics?

As the title says: How can I plot a legend outside the plotting area when using base graphics? I thought about fiddling around with layout and produce an empty plot to only contain the legend, but I ...
7 votes
1 answer
4k views

Replace Matplotlib legend's labels with image

I would like to use image instead of labels in the legend. For example, I draw 2 lines and show a legend : import matplotlib.pyplot as plt plt.plot([1,2],label="first_image") plt.plot([2,1],label="...
1 vote
1 answer
27 views

R Customize ggVennDigram legend based on internally defined categories of mapped colors - not counts nor individual intersections

First time posting here... I have a Venn diagram where I have coded certain regions of intersections based on internally defined categories. I want to produce a legend that reflects those categories. ...
0 votes
1 answer
38 views

Trying to remove the background of color icon in ggplot legend

I'm trying to remove the gray box behind the color icon in the legend of this graph. Wondering if the issue is that I'm using geom_col() so the color aesthetic is just the outline of the column. Does ...
1 vote
0 answers
39 views

Text shifted in legend because of LaTeX formatting in matplotlib

For some reason in my subplot, the legend of the second ax is cropped at the bottom inside of the legend box. It seems the index causes the text to shift a bit. The legend box itself is perfectly fine....
0 votes
1 answer
66 views

Add size legend to plotly.express.scatter_mapbox

I have a visualization done using plotly.express.scatter_mapbox. It basically shows the different institutions on the Saudi Arabia map. These institutions are marked by small circles that are color ...
1 vote
0 answers
35 views

How to add a FancyBbox as a legend?

As per the title, I'm trying to add a list of fancy bboxes to a legend : https://matplotlib.org/stable/gallery/shapes_and_collections/fancybox_demo.html. I tried the code below but there is a problem. ...

15 30 50 per page