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
2
votes
0 answers

Legend sharing Plotly Dash Legendgroup

I am working with multiple plots in my dashboard, all have same time on x axis, same multiple traces (dates) and different values on yaxis. I want to click on a chart legend and all other charts should do the same. I tried subplots, worked but…
Eric Stralsund
  • 541
  • 1
  • 5
  • 17
2
votes
2 answers

How to understand which legend is which and remove one of them in ggplot in R?

I have read many questions here and in google about legends in ggplot. However, I still can not understand why the following code produces 2 different legends and how to control them seperately. Basically what I need is to format texts on the one…
2
votes
2 answers

Python - Matplotlib: Define Individual Legend Entries

When I plot the following: plt.plot([0,1],[0,1],'g',label='Solid') plt.plot([0,1],[.5,1],'b',label='Solid') plt.plot([0,1],[1,0],'g--',label='Dashed') plt.plot([0,1],[.5,0],'b--',label='Dashed') plt.legend() I get this image: For me, this is too…
Gabriel
  • 67
  • 5
2
votes
1 answer

Add a layer without overlapping the previous parameters in Ggplot

I need these two things to happen: Layer (map) 1: These map elements in the legend should not have border line (colour = NA)! Layer (map) 2: This map element in the legend should have a red border line (colour = "red"). Problem: When I add "layer…
2
votes
1 answer

Changing legend labels in ggplot2

I want to change the label in the legend. I know this sound quite straightforward except that the actual chart is interactive, so I won't know upfront the range of values that the label may take. A simpler chart would be as…
Afiq Johari
  • 1,372
  • 1
  • 15
  • 28
2
votes
0 answers

Multiple Legends With Different Themes R

So I made a plot with multiple legends in it, but due to circumstances, I would like to make them in a different location and have the line's legend not have such a thick border. Here's the code: asset <- "JP-Morgan" ticker <- "JPM" start.date <-…
L.Zingg
  • 85
  • 1
  • 10
2
votes
0 answers

R: Legend position is c(1,0.5), but it is still inside my chart. How can I move it outside without it beeing cut off

I am plotting and saving a pie Chart and want the legend to be closer to the chart than with no position specification. When using This puts the legend inside my pie and when moving the legend even furher to the right eg 1.5 the text gets cut off…
Katsuyo
  • 63
  • 1
  • 5
2
votes
2 answers

Adjusting facet order and legend labels when using plot_model function of sjplot

I have successfully used the plot_model function of sjplot to plot a multinomial logistic regression model. The regression contains an outcome (Info Sought, with 3 levels) and 2 continuous predictors (DSA, ASA). I have also changed the values of…
jjcii
  • 139
  • 3
  • 10
2
votes
1 answer

R ggplot2 customize legend with multiple geom_bar in one dataframe

My question is close to this Legends for multiple fills in ggplot and yet not the same. Let me explain. I have a dataframe that looks like this: df <- data.frame( 'sf'=c('a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c'), 'totalsf'=c(28, NA, NA, 32,…
nathkpa
  • 121
  • 8
2
votes
1 answer

Changing the text in legend in ggplot map R Studio

I am trying to create a US map filled with heat level of flu diseases. I am having 2 issues: I couldn't change the variable text in the legend. The order of the legend is wrong. 1->10->2->... Here is the code. library(maps) library(ggplot2) # Get…
tcltan
  • 21
  • 1
  • 8
2
votes
0 answers

Adding custom value to AmLegend valueText/periodValueText in AmXYChart

I am trying to plot line chart with AmXYChart instead of serial chart as I wanted to update all the line independently on a real-time basis. And also wanted to update valueText in legend for all line graphs dynamically. I am able to get valueText…
sujit tiwari
  • 274
  • 3
  • 14
2
votes
2 answers

ggplot - mapping values below and above a threshold in different colour ranges

In the example below, I'd like to colour values above 100 in a blue colour scheme (from light blue for the closest to 100 to dark blue for the max) and values below 100 in a warm colour range (from yellow for the closest to 100 to red for the min).…
Cecile
  • 527
  • 5
  • 22
2
votes
1 answer

Circle in the legend handle doesn't work in matplotlib

I am on Ubuntu 18.04 and my matplotlib version is 2.1.1. I am trying to plot a circular patch as a figure legend handle. This example gives a way of using customized handles like this: import matplotlib.patches as mpatches import matplotlib.pyplot…
Peaceful
  • 4,920
  • 15
  • 54
  • 79
2
votes
1 answer

Multicolor scatter plot legend in Python

I have some basic car engine size, horsepower and body type data (sample shown below) body-style engine-size horsepower 0 convertible 130 111.0 2 hatchback 152 154.0 3 sedan 109 …
Maaz
  • 69
  • 1
  • 6
2
votes
1 answer

Plotly: single legend for multiple aesthetics

Is there any way to use a single legend for multiple aesthetics in Plotly? I use ggplot to plot several weeks of data and it gets very noisy. Therefore, I use both color and shape to differentiate them and ggplot just combines them in the legend.…