Questions tagged [legend-properties]

legend-properties refers to various chart libraries and the ability to programmatically customise legends in charts generated by those libraries.

legend-properties refers to various chart libraries and the ability to programmatically customise legends in charts generated by those libraries. Examples for proper use of the tag is :

413 questions
13
votes
2 answers

Geopandas reduce legend size (and remove white space below map)

I would like to know how to change the legend automatically generated by Geopandas. Mostly I would like to reduce its size because it's quite big on the generated image. The legend seems to take all the available space. Additional question, do you…
Arnaud Geotribu
  • 919
  • 4
  • 11
  • 22
11
votes
2 answers

How can I add a 2-column legend to a Matlab plot?

Consider following code: t=0:.01:(2*pi); y=[sin(t);sin(t-pi/12);sin(t-pi/6);sin(t-pi/4)]; figure(1) clf subplot(6,1,5) plot(t,y) xlim([0 2*pi]) legend('1','2','3','4') It produces following figure: Is there a way to change the…
Karlo
  • 1,630
  • 4
  • 33
  • 57
10
votes
2 answers

How to add a legend for two geom layers in one ggplot2 plot?

I've got a data frame that looks like this: glimpse(spottingIntensityByMonth) # Observations: 27 # Variables: 3 # $ yearMonth 2015-05-01, 2015-06-01, 2015-07-01, 2015-08-01, 2015-09-01, 2015-10-01, 2... # $ nClassificationsPerDayPerSpotter…
hpy
  • 1,989
  • 7
  • 26
  • 56
9
votes
3 answers

MATLAB: Assign multiple colors to text in legend

I'm trying to color code text in a legend. (Since I'm trying to sort several plots into different categories, I can't just rely on the line colors in the legend.) I've managed to set the text color for the entire legend, but I can't manage to assign…
Doresoom
  • 7,398
  • 14
  • 47
  • 61
8
votes
1 answer

How to change angle of line in customized legend in ggplot2

I'm trying to add a customized legend to my ggplot but the legend boxes have lines at an angle. I want to change that angle to 0 degrees. Is there any way to do that? Following is the code for an example…
A Gore
  • 1,870
  • 2
  • 15
  • 26
8
votes
2 answers

Remove repeated lables in matplotlib legend

If you plot several lines or points with matplotlib, sometimes you might find a situation where you will have repeated lables. For example: for i in range(5): Y1=boatarrays[i] Y2=cararrays[i] ax.plot(X,Y1,color='r',label='Boats') …
Miguel
  • 1,293
  • 1
  • 13
  • 30
8
votes
2 answers

Highcharts - Legend Positioning outside the chart

Consider I have highchart like this highchart with legend inside I want legend outside the chart. Please help. NOTE: I want my legend properties to be the same. legend{ layout: 'vertical', align: 'right', verticalAlign:…
ramya
  • 275
  • 1
  • 5
  • 13
8
votes
2 answers

How to add a string as the artist in matplotlib legend?

I am trying to create a legend in a python figure where the artist is a string (a single letter) which is then labelled. For example I would like a legend for the following figure: import numpy as np import matplotlib.pyplot as plt import string N…
Sean Elvidge
  • 263
  • 2
  • 8
8
votes
1 answer

Adding a legend title

I am new to Leaflet and I am currently struggling with tutorials. So far I managed to create an interactive clorophet map, like in the example http://leafletjs.com/examples/choropleth.html. Is it possible to add a title (simple text, not dynamic) to…
Gion Mors
  • 313
  • 1
  • 3
  • 20
8
votes
1 answer

Change ggplot coloured lines in legend to squares or circles

Instead of the coloured lines on a grey background that currently make up the legend key, I would like squares or circles of colour next to the key label in order for the colors to be easily visible. How can I do that? Here is a code snippet to use…
gd047
  • 29,749
  • 18
  • 107
  • 146
7
votes
1 answer

Google Column chart customizing legend

I would like to customize my column chart API as below 1) When I click on the legend the data set associated with it should return null and show the legend in a disabled color. My code is below. function drawVisualization() { // Create and…
7
votes
2 answers

Add horizontal lines to stacked barplot in ggplot2 in R, and show in legend

I have a stacked barplot, something like the example below. I want to add one or two sets of horizontal lines (specifying colour and line type) across each bar, at different values for each bar, and add these to the legend. Titanic.df <-…
CCID
  • 1,368
  • 5
  • 19
  • 35
7
votes
1 answer

R: positioning of the legend and length of the lines in the legend

I can't set the location of the legend properly, I have tried to play around with xjust and ncol but it still appears in the middle of the graphic. Can you help it align it to the border (left or right I do not care)? Moreover is it possible to…
Irene
  • 744
  • 1
  • 12
  • 36
6
votes
0 answers

How to move the legend position in the seaborn.objects API

I am using the new seaborn.objects API available in v0.12.0. None of the examples show how to move the legend position. For example, moving the legend to the bottom. Is there a way to do this? Using sns.move_legend, as shown in this answer results…
Abiel
  • 5,251
  • 9
  • 54
  • 74
6
votes
1 answer

Adjust Height and Width of Legend Glyphs Generated by key_glyph ggplot

I was thrilled to discover that I can change the glyph used in the legend by adding key_glyph = draw_key_rect to my geom layer. I want to make the legend wider and shorter to resemble the legend in this map by Timo Grossenbacher: I've tried…
Skiea
  • 117
  • 7
1
2
3
27 28