Skip to main content

Questions tagged [legend]

A graph legend is commonly used when plotting several sets of data within the same diagram. The legend associates each plot with its corresponding data.

1 vote
0 answers
30 views

Why is the coding for legend on my barplot not working after update?

I updated Rstudio and suddenly none of my legends are working on my barplots. It's my first time asking for help on here, so hopefully I am providing the info needed to get answers? Coding is below. ...
Rebecca Connor's user avatar
0 votes
1 answer
63 views

How to center legend text in ggplot

I have a plot that looks like this: I used these data and code to produce it: structure(list(zone = c("Zone 1", "Zone 2", "Zone 3", "Zone 4", "Zone 5&...
Ryan Gary's user avatar
  • 141
2 votes
2 answers
168 views

Specify which legend to keep in wrap_plots

I'm looking to combine multiple graphs generated from different functions into a single display. Specifically, I want to only keep the legend of the first graph in the wrap. Here is a minimal version ...
NoNameBoyy's user avatar
0 votes
1 answer
45 views

Legend is not reflecting symbol plotted in ggplot2

I have a dataframe that looks like this: structure(list(season = c("Fall", "Spring", "Summer", "Winter" ), effort = c(2559.85453311966, 4741.60449074074, 2014....
Ryan Gary's user avatar
  • 141
0 votes
1 answer
40 views

How to reverse legend order without affecting bar order in Plotly R? [duplicate]

I am creating a stacked bar chart using Plotly in R, and the order of the items in the legend is the reverse of the order that I want. library(dplyr) library(plotly) library(forcats) set.seed(1) df &...
Ernest Au's user avatar
0 votes
0 answers
13 views

Visnetwork not displaying visLegend properly

I am using the package VisNetwork and one of the attributes of the nodes contains 9 different possibilities, as follows. This is just a minimal example. In my real dataset, the column "family&...
wigo's user avatar
  • 3
1 vote
1 answer
143 views

Order of ggplot ignoring order of legends

With the following data, I am trying to create a plot as shown, but the order of legends as: mgCST Group, CST Group, Treatment Status. However, ggplot is ignoring all attempts to order the legends ...
AWillz's user avatar
  • 23
-1 votes
1 answer
40 views

Add horizontal lines with according color and legend to ggplot using R

I want to add horizontal lines so that the lines have y-intercept of period and colors according to their obj_name, ie the same colors as the line plot for each object. I succeeded in putting in these ...
Jason Liu's user avatar
1 vote
1 answer
33 views

Multiple columns in legend using ggplot

I have a dataframe (wi_hist_df) that contains three columns (below I have printed a part of it): weights Frequency Criterion 1 0.2425 2 Criterion_1 2 0.2475 15 Criterion_1 3 0....
1 vote
1 answer
45 views

How to add legend of plotted line in a box plot?

I have plotted a set of data in a boxplot, and I have added a line in the plot. I want to have the labels of the median and mean in the legend, and I have got it. However, I'm also trying to add the ...
lolloa's user avatar
  • 27
0 votes
0 answers
6 views

Can I have a legend for a data point as well as a legend for a grouped barplot in one graph

clustered barplot I have added a legend to show the bars in a barplot, but I cannot figure out how to add the data point (+) to the legend. I want the data points that are + to be labeled in the ...
Hannah Martin's user avatar
0 votes
0 answers
22 views

Line2D multiple colors in legend [duplicate]

I want to create a custom legend. Here, in the example, I create two lines. But for this line, which now is blue, I would like it to be in multiple colors: blue, green, and red. Here is a minimum ...
blahblah's user avatar
0 votes
1 answer
45 views

how to have a legend for size of geom_points() and also set the size of the dots themselves?

I am trying to plot a sort of bubble plot but i am unable to set the size of the dots and have a legend explaining how the sizing works. These are two examples which combined give me the expected ...
gabt's user avatar
  • 774
0 votes
0 answers
13 views

Matplotlib not changing legend labels for a plot in python package pyAT

So I am attempting to use a python interface of Accelerator Toolbox (pyAT: link here) to simulate the path of a few particles through an energy spectrometer. From this interface, I've utilized a ...
tfs563's user avatar
  • 1
0 votes
0 answers
70 views

Left padding on right positioning legend in react-chartjs-2 line chart

I am using react-chartjs-2 line chart and assign legend position to right side but graph and legend does not containing the space. I want to provide left padding to my legend which create the space ...
user24101712's user avatar
0 votes
1 answer
19 views

ggplot manually adjusting attributes

I am trying to change the legend on this plot in ggplot. I want it to have both the appropriate linetype and color in the one legend. However, I would be satisfied if I could just fix the linetype ...
kpr62's user avatar
  • 561
1 vote
1 answer
116 views

how to change size of symbol in ggplot2 when size, shape, and color are set through geom_point?

The problem i am having is surely trivial, and yet i am unable to solve it. What i need is to have my own shape, colour, and size for the geom_point(). However, if i set it, the size of the symbols in ...
gabt's user avatar
  • 774
2 votes
0 answers
47 views

Add p-value breaks to a gene oncology dot plot [closed]

I am so close to finishing up a gene oncology-gene ratio figure for a lab assignment, but I am struggling with adjusting my p-value breaks. I'd like to have control to having p-value range from 0.001 ...
KenH's user avatar
  • 31
0 votes
0 answers
33 views

Inserting legend in a Matplotlib/Geopandas Map

I've created a incidence map for a city, but now i need to manipulate the legend ( decrease its size, put it bellow the map/graph, insert labels). i've used a json file to plot the territory. Here's ...
gongmaodu's user avatar
0 votes
0 answers
28 views

ECharts confidence bands in legend as one item

I counstructed ECharts confidence bands around the main series, similar to example. However, in the example there is no legend. I use legend and I want to show main data as one legend item and ...
Lovor's user avatar
  • 243
0 votes
0 answers
41 views

R's plotly ggplotly removing legend from a geom_point

I'm generating a simple geom_point plot with R ggplot2: library(dplyr) library(ggplot2) set.seed(1) df <- matrix(runif(16, 0, 10), nrow = 4, ncol = 4, dimnames = list(paste0("R", 1:4), ...
dan's user avatar
  • 6,242
1 vote
2 answers
42 views

Separate Legend Entries for Individual Outlined Overlapping Bars

I am creating a ggplot with multiple overlapping bar plots. The first underlying bar is filled with color and then I overlay one more set of bars with just an outline to show sub-components. I would ...
fowlermw's user avatar
0 votes
1 answer
78 views

How to show values next to bars in tornado chart using ggplot in R [closed]

I have this table (T_Tornado_Total_EM_HM_sort): And these are the lines that I used to make the tornado chart: ggplot(T_Tornado_Total_EM_HM_sort, aes(Tipovi_troškova, RSD, fill=Populacija)) + ...
newtoR's user avatar
  • 35
0 votes
0 answers
28 views

ggplot legend in R not recognising aesthetic changes for label category with no data points

Consider the following image: Although the underlying dataset does not contain values below 0.1 degrees Celsius, I want to and still can force the legend to display the label and box for 'Below 0.1', ...
shogi's user avatar
  • 65
1 vote
1 answer
61 views

How to make pyplot Hatches look pretty in the legend

I have a problem and struggle to find a solution, or phrase the question for a search engine. I have many python plots where i use hatches to show exclusions from constraints (so some hatches are not ...
TheMaker845's user avatar
1 vote
0 answers
31 views

Removing Duplicate Legend Entries using VBA

This code is to remove repeat legend entries. It will work as long as there isn't any series on the 2nd Y axis. As then the Series collection order and the LegendEntries order are different. I would ...
James's user avatar
  • 31
0 votes
0 answers
46 views

Is there a way to move the legend in a trackViewer lollipopPlot and/or change its orientation?

Is there any way to alter the position or orientation of a legend in a trackViewer lollipopPlot (or fudge something that performs the same function), so that it's on the side of the plot and directly ...
KeyboardCat's user avatar
0 votes
1 answer
35 views

ggplot2 - how to keep the legend items with the same size, when geom_segment() has different sizes? [duplicate]

I'm plotting several segments as once using ggplot2, with two different sizes. An example of what I want to do is provided in one of the answers here. Here's the example they provide: ggplot2::ggplot()...
mto23's user avatar
  • 391
0 votes
3 answers
63 views

Having different shapes of points for each line and making them shown on the legends

My goal is to make the graph look something like this My Goal. The problem I'm having is that ggplot won't let me use more than 6 kinds of shapes for the points, so my graph looks something like this ...
Jason Liu's user avatar
0 votes
2 answers
37 views

Overlapping legend of a line plot

I want to show each line as having a different color and shape, and that should be reflected on the legend. Basically, it should look something like this My Goal. I could make the color and point ...
Jason Liu's user avatar
1 vote
0 answers
35 views

How to align legend elements in the middle when they are on two rows using ggplot2?

In the MWE below, the caption appears separated into two rows. I want the item corresponding to gear 5 to be aligned in the middle in relation to gears 3 and 4 above it. How can I do this? library(...
Daniel Valencia C.'s user avatar
0 votes
1 answer
94 views

How do I add a legend to ggplot with two scatter plots (geom_point() )

I have a table I read into R to plot with ggplots. I need to plot two sets of data points and also use an ifelse condition to be able to show specific genes. I would like to show a legend to the plot, ...
Assa Yeroslaviz's user avatar
1 vote
1 answer
105 views

How to customize the legend order for a 3D scatter plot?

I'm trying to generate a 3D scatter plot and the shapes of markers correspond to 'Treatment' (IC, IT, YS), whilst, the colors correspond to 'Time' (0, 2, 4, 6, 12, 24, 48, 72). Everything went well ...
SIV0625TriX's user avatar
1 vote
1 answer
64 views

Why doesn't sns.barplot legend show all values?

I have the following graph. Why does the last graph legend not contain all labels? It should contain these values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 20, 21] Code: # select only this year ...
John Doe's user avatar
  • 319
1 vote
1 answer
75 views

Title and legend adjustment with `grid.arrange`

I have 6 different plots in R that I want to arrange in one plot with grid.arrange. They share the same legend, but whenever I want to put a common legend, the sizes of the plots are adjusted ...
Masal Gezici's user avatar
0 votes
0 answers
36 views

Modal-Opener Inside fieldset/legend element

On the Shopify product-page I want to display a Size-Chart. Unfortunately I have way to less experience to get the text inside the element. This is the code which styles the elements like size and ...
ParaMeds's user avatar
0 votes
0 answers
42 views

Excel chart legend does not list all values

I'm using Excel for Microsoft 365 Version 2402 (latest as of March 2024), and I have the following table and associated chart: The blue triangle in the center of the chart is for the value 80. In the ...
haidahaida's user avatar
0 votes
1 answer
248 views

How to add spacing between Legend and Chart in Recharts with absolute positioning?

I'm using Recharts for the first time in my React project I've positioned the legend of my BarChart component to the top right corner. However, I'm struggling to add spacing between the legend and the ...
vincentvdt's user avatar
0 votes
0 answers
26 views

Entrywidth argument not working in R plotly

I am trying to make an interactive plot with the plotly package. The legend needs to be next to the image and have a certain width. I now have the issue that the default appears to be that the legend ...
Bramminator's user avatar
1 vote
1 answer
37 views

Highlighting or selecting all values from Legend

Why when hovering over the bottom "legend" every time only one of the entries or the last one is highlighted. Is there a way to highlight or even better select all components which have same ...
Riyad Bakhshiyev's user avatar
0 votes
1 answer
54 views

How do you remove pattern_fill legend?

I'm wondering how and if it's possible to remove the legend created by pattern_fill? This is my data: #To use non-english characters Sys.setlocale("LC_ALL", "nb-NO.UTF-8") library(...
Henning Åsheim's user avatar
0 votes
1 answer
38 views

Shared legend for 2 Highcharts using React

I want a shared legend for 2 areaspline highcharts. Using react, I am unable to create that shared legend between the 2. My code: component.js: import React from "react"; import "...
nb_nb_nb's user avatar
  • 1,347
0 votes
1 answer
48 views

How to Display Values Next to Legend in React Pie Chart? Getting 'Undefined' Error

I am trying to display value next to legend, but I am getting undefined. Debugged but no luck, can you let me know how to fix it. Providing my code snippet and stackblitz below https://stackblitz.com/...
Ram01's user avatar
  • 171
0 votes
1 answer
309 views

How to customize the legend of Seaborn plot

I was trying to customize the legend of my seaborn plot adding also the values into the legend just after the color and the name of each x entry. In this case, it will be color, x value, y value. ...
Marco Favaretto's user avatar
0 votes
1 answer
40 views

Change layout of legend2 in plotly

How to change layout of legend2 with fig.update_layout()? import plotly.express as px import pandas as pd numbers = pd.DataFrame([[1,2,3,4], [2,3,4,5], [5,7,8,8]]) asdf = px.line(numbers) asdf = asdf....
Václav Bočan's user avatar
0 votes
0 answers
23 views

How to customize legends in Power BI for shapefile?

I am working with county level shapefile for China and for each county I have some values. I have uploaded the shapefile in Json format in Power BI like below. I wanted to create legend as below map ...
Raj's user avatar
  • 65
0 votes
0 answers
20 views

how to mpchart legend text Color change in android

When I googled the information, it said that I could use setCustom. Only form, not label text is allowed in the entry in this section. What I want is to make the legend's form color and label color ...
Duseop's user avatar
  • 149
0 votes
1 answer
34 views

Legend of the library Fantaxtic

I am running the library fantaxtic in R studio. I want to make a bar chart or something like that. However, in the legend I don't want any title in the legend and the category Other is located at the ...
user1892205's user avatar
0 votes
1 answer
35 views

One variable with three colors, but only one color on the legend

I have two variables in my table. I want one of them to appear with three colors on the graph, but only one color on the legend. How can I remove the NAs, which don't correspond to separate variables, ...
Montacer's user avatar
0 votes
1 answer
47 views

Removing underscores from ggplot2 boxplot [duplicate]

I would like to remove an underscore out of my ggplot2 boxplot (the head of fill "fungicide_treatment". I already tried to change the column head in my excel data file, and I tried already ...
Stephan Graßl's user avatar

15 30 50 per page