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
3
votes
1 answer

Making a static legend, independent of the actual plot

I'm plotting two surfaces in Matlab, the ground level which is constant and the water level which is changing in time. I use an if statement to change the colormap of the water with increasing depth, determined by two thresholds (in the code below…
3
votes
2 answers

Increase spacing between legend groups with patchwork settings

UPDATE: The suggested code here p1 + p2 + p3 + plot_layout(ncol = 1) + plot_annotation(tag_levels = 'a') & theme(legend.justification = "left") returned this I need to have the legend groups aligned with the respective plots and I'm using…
hnguyen
  • 772
  • 6
  • 17
3
votes
1 answer

How can I show legend of multiple layers (geom_point and geom_bar)?

I have two data sets that I want to combine into one plot, one as a barplot (2 groups) and one as a point-line plot (1 group). I've managed to combine the plots and show the legend for the barplot, but whenever I try to show the legend for the…
Keni
  • 63
  • 5
3
votes
1 answer

Is it possible to add 6 colors in one key-label in my legend with ggplot2?

I am very new here, but I've always had so much help going trough other peoples questions and answers that I thought I'd try if anybody could help me out. I think I might just be looking for something that is impossible, but I hope not! Perhaps some…
TesselL
  • 33
  • 6
3
votes
1 answer

Adjusting the legend spacing in Matlab

I have slightly lengthy legend titles as shown in the figure below. Is there a way to adjust the location of 'a val' / 'b val' more towards the centre of their title name (move leftwards)? Similarly for 'c limit' /'d limit' ( move towards…
Shiva
  • 69
  • 6
3
votes
1 answer

Adding image to legend in matplotlib returns error: AttributeError: 'BarContainer' object has no attribute '_transform'

Given the following code: import numpy as np import matplotlib.pyplot as plt import os, sys labels = ['G1', 'G2', 'G3', 'G4', 'G5'] men_means = [20, 34, 30, 35, 27] women_means = [25, 32, 34, 20, 25] x = np.arange(len(labels)) # the label…
Farid Alijani
  • 839
  • 1
  • 7
  • 25
3
votes
1 answer

Plotly: How to customize legend order?

I made scatter_geo plot in Python within plotly. import plotly.express as px import pandas as pd rows=[['501-600','65','122.58333','45.36667'], ['till 500','54','12.5','27.5'], ['more 1001','51','-115.53333','38.08'], …
Dmitry
  • 361
  • 6
  • 21
3
votes
1 answer

Arrange ggsurv plots with one shared legend

I am trying to plot several Kaplan Meijer curves in a grid with a shared legend in R. Here (common legend in arrange_ggsurvplots) ggsurvplot_facet is advised. However, in my case, every plot is based on a different fit using different variables, so…
Peter
  • 343
  • 5
  • 17
3
votes
0 answers

Colorbar too big - Python Matplotlib

I want to plot a geodataframe from Buenos Aires, the proportion of poor houses. There's the code: import pandas as pd import geopandas as gpd import matplotlib.pyplot as…
Tomás
  • 31
  • 4
3
votes
1 answer

Dash graph selected legend items as input to callback

I have a Dash app with a dcc.Graph object and a legend for multiple deselectable traces. How can I pass the list of traces selected in the legend as an input to a callback?
Austin
  • 6,921
  • 12
  • 73
  • 138
3
votes
3 answers

remove strikethrough behavior in chart.js bar chart

i am trying to change the look of the legends by removing the strikethrough effect , wihtout using legendCallback function in chart.js. The reason why i do not want to use the legendCallback function because i have my own custmizations in …
Hunt
  • 8,215
  • 28
  • 116
  • 256
3
votes
0 answers

How to show outliers and mean-line separate from boxplot in ggplot legend?

I am creating a plot with multiple pairs of boxes, I also have a pair mean lines going through the plot, and many outliers shown. The legend currently shows the two boxes, however I would like it to show the two boxes, as well as the two mean lines,…
Jason
  • 73
  • 1
  • 7
3
votes
0 answers

Show only top 5 values in legend for Pie Chart (Am4 charts)

I have a pie chart with legends made using Am4 charts but I need to display only the top 5 legend values. I wrote the following code: var chart = am4core.create("chartdiv2", am4charts.PieChart); chart.hiddenState.properties.opacity = 0; //…
Thanatos
  • 282
  • 5
  • 18
3
votes
1 answer

How to add legend elements in Matlab in the plot itself

I want to somehow label vertical lines in Matlab. I could imagine two options: Either by having legend entries right next to each vertical line itself, or by having the vertical lines numbered in the graph and then having the numbers re-appear in…
LenaH
  • 313
  • 2
  • 14
3
votes
2 answers

Legend box out of boundary when saving with ggsave()

I've placed my legend horizontally (5 categories) below my barpchart, within r this works fine, but when I save my plot as a picture some categories from the legend disappear or are out of boundary of the plot/picture. I used ggsave("myPlot.png", p,…
Benjamin Telkamp
  • 1,451
  • 2
  • 17
  • 31