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
1
vote
1 answer

Align the legend labels and handles for a combined line and scatter plot

I have this MRE: import matplotlib.pyplot as plt import numpy as np for i in range(6): plt.plot(np.linspace(0,1), np.linspace(0,1)**(i+1), label=f'{i}') for i in [0,2,4]: plt.scatter(np.linspace(0,1), np.linspace(0,1)**(i+1),…
tommy J
  • 91
  • 3
1
vote
1 answer

get legend labels (text) from ggplot

I am trying to extract the label text from a ggplot legend object, e.g. for this plot: library(ggplot2) (p <- ggplot(mtcars, aes(x=mpg, y=disp, color=as.character(cyl))) + geom_point()) I can extract the legends via library(ggpubr) legend <-…
MartijnVanAttekum
  • 1,405
  • 12
  • 20
1
vote
1 answer

How can I match the colors of lines and legend entries in ggplot2?

I have a dataframe of some spectra (one x-value, several y-values) and want to plot them in one graph. For this purpose, I want to use ggplot. After some research, I found a way to do so, but I want to change the color of the lines from black to…
Excelsior
  • 125
  • 4
1
vote
3 answers

Changing legend symbols in ggplot2

I have this plot made in ggplot2 With the following code: colors4 <- c("Exp" = "#000000", "TL 1" = "#56B4E9", "TL 2"="#CC79A7", "TL 3"="#009E73", "TL 4"="#D55E00", "Model"="#999999") ggplot(binodalbetla, aes(x=w.sal,y=w.tpc,colour=Category),…
1
vote
0 answers

Make legend horizontal and reduce the size in Plotly Dash

I am trying to make the attached legend horizontal and smaller in size but it's not working. Also if you see the Plot is hidden below the legend. (Some states are not visible) How can I set that to floating? So that all the US States can be seen…
1
vote
1 answer

Legend in geopandas plot for color as well as for markersize

I am creating a geopandas plot in which I have colors dependent on a column value and the markersize on another column value. When I put legend= True the plot only shows the colors in the legend and not the values of the markersize. Anyone knows how…
1
vote
1 answer

Legend Series Doubled in Line Chart

I've been trying to edit my legend on a line chart to use different symbols for each field in the series. My output on the actual chart is showing correctly, where each series had a different symbol, but my legend duplicates the series, one showing…
Bryan
  • 15
  • 2
1
vote
1 answer

Add text to legend symbols in ggplot

Using geom_rect I am separating my data into classes in a ggplot. These classes (v high, high, medium, low, v low) are denoted in the legend. Is there a possibility to add the lower and upper limits of the classes from the data.frame to the legend…
Lisa P
  • 11
  • 1
1
vote
1 answer

How to make alpha (transparency) appear as continuous gradient in the ggplot legend?

Is it possible to make the transparency (alpha) appear as a continuous gradient in the ggplot legend? Currently, the plot looks like this: Here, the different values for alpha are represented by dots in a different transparency. I would like it to…
1
vote
0 answers

Leaflet legend with subtitles for grouped values

Is there a way to add subtitles to leaflet legends? The following example produces a functioning legend. However, is there a way to combine the subgroups to the same legend? I could imagine this could be solved by injecting custom CSS-code to the…
Beni
  • 191
  • 9
1
vote
1 answer

Adding multiple legends to multiple subplots

I am trying to display multiple legends within multiple subplots. Currently, I am able to create figures with subplots and display multiple legends within one plot but can't combine the two. They seem to default to the last subplot. This is the code…
1
vote
0 answers

Remove a dark background from `geom_line` `ggplot2` legend

I am trying to build a plot with geom_rect and geom_line. I don't know how to remove dark color in the legend background after placing geom_line. Here's my code gp <- (gp + ggplot2::geom_rect(data = dd5, mapping…
crusher083
  • 171
  • 2
  • 10
1
vote
1 answer

How to change the font family of matplotlib legend AND legend title?

I would like to use the font family "Consolas" in my matplotlib legend in order to benefit the monospaced font. I also want a legend title. But it seems that when I change the font family of my legend, it erase the legend title. Here is a code to…
Samovian
  • 173
  • 1
  • 7
1
vote
1 answer

How can I put different legends to subplots in plotly?

I am still designing what kind of plot with subplots I want to do but when we see the example in the documentation Multiple Subplots with Titles we have from plotly.subplots import make_subplots import plotly.graph_objects as go fig =…
KansaiRobot
  • 7,564
  • 11
  • 71
  • 150
1
vote
1 answer

Highcharts -> how to add vertical title to bar? how to make the symbol in the legend a rectangle?

`https://codepen.io/martynakil/pen/BawpPJv` how to add vertical title to bar? how to make the symbol in the legend a rectangle? I need: title vertical symbol a reactangle a vertical line that separates the negative value from the positive…
MarKil
  • 19
  • 3