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

Matlab: Reduce the spacing between symbols and labels in the legend

When using the legend command in matlab, how can I reduce the horizontal distance between the legend symbols and their corresponding labels? Example code: Line1=plot(x1,y1,'s'); Line2=plot(x2,y2,'o'); Line3=plot(x3,y3,'^'); Leg=legend([Line1,…
mrsoltys
  • 1,075
  • 10
  • 13
3
votes
2 answers

ggplot + geom_point + legend based on both size and color

Is there a way to display both size and color in the legend when using geom_point? library(ggplot2) cons2 <- data.frame( value_date = as.Date(c('2013-04-30', '2013-04-30', '2013-06-13', '2013-06-13')), ticker = c('AAPL','FTW','AAPL','FTW'), …
Børge Klungerbo
  • 177
  • 3
  • 11
2
votes
1 answer

R - legend is partly over plotly diagram (facet wrap)

I've searched but not find anyone w this issue and thus no solution. I've come to understand that you move the legend around with the legend attribute: layout(title = list(text = paste0('Arbetskraftsdeltagande och sysselsättningsgrad', …
Christian
  • 117
  • 1
  • 3
  • 10
2
votes
1 answer

How to add a new (custom) variable to a ggplot legend

I've run a number of models with two estimated parameters per model with five groups and two treatments. I'm trying to graph the confidence intervals of these estimates in a large panel plot. Since, I've simulated these data sets I would like to be…
Jade131621
  • 316
  • 1
  • 13
2
votes
1 answer

Manually add legend entry to Seaborn Legend

I create overlaying distribution plots by group memberships using gfg = sns.displot(hist_dat, x="Outcome", hue="Group", kind="kde", fill = True, palette="tab10", height=10.5, aspect=18.5/10.5,…
2
votes
3 answers

Manually set legend colors

I try to plot the following line plot, but I have difficulties to manually set legend colors. Currently the legend colors did not match the line colors. Any help would be very helpful. Thank you. import random import matplotlib.pyplot as…
Tuyen
  • 977
  • 1
  • 8
  • 23
2
votes
1 answer

Is there a way to rename the categories of the legend?

I'm looking for a way to change the name of the legend of the graph without changing the data?
rushi
  • 225
  • 1
  • 3
  • 7
2
votes
1 answer

seaborn lineplot: marker symbols missing on legend

I have a seaborn lineplot with marker symbol "o" (the same symbol should be used for all series). Works well for the chart, but the marker symbol is missing in the legend (see screenshot). How can I make it appear? Code: import seaborn as sns fmri =…
Barden
  • 1,020
  • 1
  • 10
  • 17
2
votes
2 answers

How to combine fill (columns) and color (points and lines) legends in a single plot made with ggplot2?

In a chart I have columns and points. I'm trying to unify the legend; I've already put the same name on the scales, but they still appear separate. Could someone please help me solve this issue? library(ggplot2) X <- factor(c("a", "b")) Y1 <- c(10,…
Daniel Valencia C.
  • 2,159
  • 2
  • 19
  • 38
2
votes
2 answers

plot function in R producing legend without legend() being called

I'm trying to produce a cumulative incidence plot for a competing hazards survival analysis using plot() in R. For some reason, the plot that is produced has a legend that I have not called. The legend is intersecting with the lines on my graph and…
gcgoobie
  • 53
  • 2
2
votes
1 answer

How can I customize labels in ggplot guide_colorsteps?

This example code gives me everything I want except for the colorbar labels. require(ggplot2) require(RColorBrewer) df <- faithfuld pbase <- ggplot(data=df, aes(x=waiting, y=eruptions)) p1 <- pbase + geom_contour_filled(aes(z=100*density), …
Fleetboat
  • 189
  • 7
2
votes
1 answer

Matplotlib change length of legend lines

I have the following code to generate the plots with a shared legend from matplotlib.legend_handler import HandlerLine2D, HandlerTuple import matplotlib.pyplot as pt fig = pt.figure(figsize = (12,4)) gd = fig.add_gridspec(1,2) p1 =…
Bebotron
  • 383
  • 2
  • 11
2
votes
1 answer

Legend properties does not change when the location is changed in octave

Below is a part of my code. [leg, hobj1] = legend('MFR1', 'MFR2', 'MFR3', 'MFR4', 'MFR5', 'Reference') ; textobj = findobj(hobj1, 'type', 'text'); set(textobj, 'Interpreter', 'latex', 'fontsize', 12); legend(leg, "location",…
Emotional Damage
  • 138
  • 1
  • 1
  • 9
2
votes
1 answer

Creating a key for box plot mean and median lines in Matplotlib

I have the following code which creates a box plot of APOE4 gene copies and memory scores (hence the variable names) clean_merged.boxplot('composite scores', by='APOE4', widths = 0.8, showmeans = True, meanline = True) plt.title('Mean Composite…
2
votes
5 answers

Matplotlib Legend Wont Show Up

Every option I try does not get the legend to show for my plot. Please help. Here's the code and the plot works fine with all my inputs being simple NumPy arrays. When adding the legend function a tiny box appears in the corner so I know that the…