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.
legend
5,166
questions
1
vote
0
answers
131
views
How to add space between Legend text and chart in ChartJs v4
I'm using Chart.js version 4.4.1, and I want to increase the space between the legend and the chart.
I need a solution for barchart. I'm sharing the code for the bar chart.
I've checked several posts, ...
0
votes
0
answers
21
views
plotly express legend not responsive to any attempt at adjustment (including complete removal)
I am doing a visualization for a paper im writing about differences in specific stances between men and women.
In order to do this, i want to create a plotly figure with 4 subplots. This worked great, ...
0
votes
0
answers
16
views
No marker on line titles
I want to remove the markers (dots) after every keys as shown in the figure. I just need the title. Also please suggest me simple way to move individual title near to the curves. I am using ...
0
votes
1
answer
258
views
ChartJS Customised tooltip and LegendText not displaying after version update
Earlier i was using 2.7.2 version of ChartJS, now im updating to 4.4.1
So in my chart i was creating customized tooltip and customized Legend text but after version update both are not working
Here is ...
1
vote
0
answers
18
views
Legend repeatition for scatter subplots in poltly express
I have a dataframe and I have plotted four different columns of the dataframe each with a 5th column and colour them based on a 6th categorical column as subplots in the same figure.
I want to have ...
1
vote
1
answer
86
views
ggplot: How to drop certain factor level from legend while still be able to set its colour?
I need do make density plots of the age of the workers of a company. One density plot shall show age of all workers and the other split by sex. It is something like this:
# Load libraries.
library(...
1
vote
1
answer
38
views
annotate box to follow legend position ggplot2
My data:
plot_data <- structure(list(date = structure(c(18993, 18994, 18995, 18996,
18997, 18998, 18999, 19000, 19001, 19002, 19003, 19004, 19005,
19006, 19007, 19008, 19009, 19010, 19011, 19012, ...
0
votes
0
answers
84
views
How to manage overlapping yticks and legends in a heatmap plot in julia?
enter image description here
I'm trying to create a heatmap featuring yticks on both the left and right side of each row. While plotting, I've encountered an issue where the yticks on the right side ...
1
vote
1
answer
82
views
Choosing elements for a legend in Python
I am using py.plot to display the upper and lower bounds of confidence intervals (shaded in between). I would like to label each pair of bounds with the item they are measuring. However, Python seems ...
0
votes
1
answer
71
views
Bokeh legend breaks on Python callback
I have implemented a Bokeh figure with
a scatter plot using circle() with a legend_group for colouring and for creating an interactive legend.
a range slider with a Python callback that filters the ...
-1
votes
1
answer
84
views
How to customize the min and max vertex size when plot igraph object and create legend at selected vertex size
Here is an igraph object with 10 vertices and each vertex is assigned one of two colors. I want to plot this graph with vertex size varying by a variable called val, which is a vector of length 10 and ...
0
votes
2
answers
44
views
in ggplot2 , how to make different legend on the different position
Blow plot have two legend size and color ,currently the positon on right .How to marke size legend on the left ,meanwhile the color legend on the top ? Thanks!
library(tidyverse)
diamonds %>% head(...
0
votes
1
answer
148
views
Gnuplot - How to make a legend with linespoints?
I've been playing around with the code that was posted here. Then, I was trying to add a legend with linespoints. This resulted in having the fit line being covered with points.
I've tried to set the ...
0
votes
1
answer
226
views
Legend in matplotlib jumps around with minimal change to bbox_to_anchor parameters
I have this issue in matplotlib that drives me crazy. I want to position the legend within the plot to be in a certain position, for example, in this case, in the top left corner (matching the corner ...
0
votes
0
answers
177
views
Issue with R Animation: missing axis labels and tick marks
I've just begun to explore animations using ggplot2 and gganimate, and in multiple use cases I'm finding that elements like legends and axis labels are being omitted from the final animation. For ...
0
votes
0
answers
82
views
Removing part of the legend in ggplot2
I have an overlapping of three stat_contour_filled functions using also ggpattern (you can see the "background" in my previous question). Here is my code:
v<-ggplot(df, aes(pi1,pi2,z=val))...
0
votes
1
answer
183
views
R, ggplot2, patchwork: combine legends with comparable (but different) sets of values
I've reviewed other questions along these sames lines about combining plot legends with the patchwork package, but my question is different in that 3 of the 4 combined graphs have overlapping values. ...
0
votes
0
answers
51
views
Legend not showing in ggplot graph
Help! Trying to plot a scatter plot, with a regression line, and a horizontal line marking a target level. Below is my code - I can't seem to figure out how to get the legend to show up.
ggplot(...
0
votes
1
answer
57
views
Legend and labels for Plotly express line graph
I want to draw a three graphs on one x-y axes using Plotly.express.
I've read a CSV file of monthly returns using pandas, and have a pandas dataframe containing four series: Date, IRA, MSCI and SnP.
I ...
1
vote
0
answers
22
views
Untoggle *all* legend items in an Altair chart in a Jupyter notebook
I'm trying to create a chart with Altair in a Jupyter notebook. It's basically a line-chart of various currency values over time. I included my code below.
I can toggle currencies using the legend, ...
0
votes
0
answers
7
views
How can I include two categories of label (colour coded and shapes) in a single legend for a single dataset using a matplotlib scatterplot?
I have a dataset, texts, that I want to display using a scatterplot. The texts represented in this dataset have different authors, and are written in different languages. I want to represent the ...
0
votes
0
answers
28
views
Customs Legends using to select components
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 all components which have same color?
Or like using ...
0
votes
1
answer
25
views
gplot legend problem with geomcol plot and geompoint + geomline plot
I made this plot with ggplot, with a bargraph and two line and points plots.
I can't figure out why also the two line and points plots in the legend have the square around them as for the barplot.
I'd ...
0
votes
1
answer
81
views
Julia scatter plot legend based on colour of point
I am plotting two arrays against each other and basing their point colour on the index in the array using a dictionary. I need to now add a legend but am stuck.
I would value opinion on both a more ...
0
votes
0
answers
24
views
R: GIS / Census data - scale_fill_continuous - need to drop default legend and keep custom legend (using tidycensus)
all - I've created a map of Census block groups shaded by % Families in Poverty. Then, I've overlaid city boundaries and a map of certain types of events. It all looks great except that the color ...
0
votes
1
answer
31
views
legend in scatter plot using dataframe
Only the first data name i.e 'Manchester City' is displayed in the legend.
import pandas as pd
import matplotlib.pyplot as plt
df1=pd.read_csv(r'F:\anoch\IPproject\FSTS\teams.csv')
df1.plot(kind='...
2
votes
1
answer
172
views
How to have a combined legend for colors and marker types
I frequently generate complex plots and strive to simplify the legends. In this particular instance, I am plotting data categorized by multiple models and temperature bands. I want to include two ...
0
votes
0
answers
3
views
Auto filling a filed from another separate field when a checkbox is checked
function billingFunction (){ if(document.getElementById('same').checked){
document.getElementById('billingName').setAttribute('value') = document.getElementById('shippingName').value
document....
0
votes
1
answer
72
views
How to create a bar graph to visually represent two variables, while keeping the same color for the x-axis variable?
For example, here is a data.
Genotype=c("A","A","B","B","C","C","A","A","B","B","C","...
0
votes
0
answers
206
views
Chart js - v 4 How can I change the order of chart legend
The legend was created using the html Legend Plugin, which is displayed differently from the order in which you draw the chart
Is there a way to change the legend order to match the data order?
I ...
1
vote
0
answers
71
views
In R, how to adjust multiple legend position separately in graph?
Here is one data.
Nitrogen= c(0, 50, 100, 0, 50, 100)
Season= c("2020yr", "2021yr", "2022yr", "2020yr", "2021yr", "2022yr")
Yield= c(20, 30, ...
0
votes
1
answer
137
views
How do I add a legend without using aes() in R with ggplot2?
I'm currently plotting a double axis graph using a bar chart and line graph, and want to add a legend at the bottom of the chart to show that the blue bar chart represents new constructions and the ...
0
votes
1
answer
56
views
How to combine normal font and latex font types in Matplotlib?
I am aware of Matplotlib's math_fontfamily to mix family font types within the same string. I use the feature for my title and it works perfectly fine. For example:
ax[0].set_title(r'Total response $\...
0
votes
1
answer
42
views
Conflict between scale_color_gradient2() and scale_color_manual()
What I want is to remove diffmean legend produced by geom_segment() and scale_color_gradient2() and add legend for both dotted line and solid line (geom_line()). I have tried:
ggplot2::geom_segment(...
0
votes
1
answer
17
views
How can I implement tooltips for Rickshaw legends?
I'm using Rickshaw to display a graph of several time series with a legend. I would like to display some text when the user hovers the mouse cursor over an entry in the legend. There is apparently no ...
0
votes
0
answers
32
views
How to add tags for a data point in an image [duplicate]
With the following code, I plot a graph as follows:
import matplotlib.pyplot as plt
# Sample data
gflops_a = [72.3, 74.5, 79.6, 82.5]
model_a_ACC = [9.3, 9.7, 11.2, 14.2]
gflops_b = [73.95, 75.2, ...
1
vote
1
answer
108
views
Custom legend at the bottom in Vega-lite
I had a problem which solution was this. But now I want to change position of the legend to make it at the bottom like in the image. How it can be done?
Image
0
votes
1
answer
182
views
How can I manually specify text for legends in sympy.plotting.plot?
I am using sympy.plotting.plot for plotting different functions. I want
to add manual labels.
This is what I tried, however, I would like to have ‘Foo1’ in line 1 of
the legend and ‘Foo2’ in line 2 of ...
0
votes
0
answers
53
views
Imshow Plotly colour toggling using legend
I'm currently working on a data visualisation using Plotly in Python, and I've hit a bit of a roadblock.
I have a 2D array representing image data, and I'm using plotly.express.imshow to display it. ...
0
votes
0
answers
69
views
Manually add Errorbar to Legend (ErrorbarContainer)
I would like to add a manual legend to a matplotlib plot of this nature:
While I managed to add the horizontal bars to my legend, I am stuck with the creation of the horizontal error bars.
I based my ...
0
votes
2
answers
49
views
Range Graph with `ggplot2` with Legend
I am trying to make a "Range Graph" with ggplot2 package. I found some guides online but without the possibility to make a Legend.
library(tidyverse)
library(ggplot2)
# Dataframe creation
...
0
votes
1
answer
33
views
ggplot: combine legends of different datasets
In the plot below, you see two datasets plotted together using ggplot. The first dataset uses geom_pointrange() and the second one geom_ribbon() and geom_line(). As I haven't found a way to show the ...
1
vote
1
answer
114
views
Legend colors based on dynamic Lables
I have such a problem that I made custom labels, but also want to make them custom colored. When declaring in colors {scale: {domain:... range:...}} I cannot use my custom labels and whatever in ...
1
vote
2
answers
288
views
How to create a single figure legend for GeoAxes subplots
I have looked at the many other questions on here to try and solve this but for whatever reason I cannot. Each solution seems to give me the same error, or returns nothing at all.
I have a list of six ...
2
votes
1
answer
102
views
How to show legend in a plot with both bars and points?
I have a dataframe the looks as follows:
COUNTRY YEAR y
AT 2019 25
AT 2020 38.0
AT 2021 23.4
BE 2019 11.1
BE 2020 18.6
BE 2021 15.0
DK 2019 ...
0
votes
1
answer
62
views
Modify legend color of a matplotlib plot created by gluonts
I'm using gluonts and plotting a forecast (code from DeepVaR notebook).
The code is the following:
def plot_prob_forecasts(ts_entry, forecast_entry, asset_name, plot_length=20):
...
-1
votes
1
answer
72
views
How to separate legend and chart when having three chart
i have 3 pie charts which have legend in below but in first pie charts there are 10 legend and in second there are only 4 legend then when i give padding to chart to adjust the 10 legend then in ...
0
votes
0
answers
36
views
Google charts tooltip on legend hover
I am using google charts.
I am trying to show multiple tooltips on legend hover on line and bar charts.
I am successful in showing multiple tooltips on legends but they are working on click and not ...
0
votes
1
answer
162
views
r ggplot different size depending on shape
I have the following R code:
x <- rep(c(1:5), 5)
y <- rep(1:5, each=5)
z <- rep(seq(0, 1000, 250), each=5)
w1 <- c(15:18,25)
w2 <- c("\u25A0", "\u25CF", "\u25B2&...
1
vote
1
answer
358
views
Plot_model() How to change legend title when color is set to black and white
In plot_model() function (sjPlot package), setting colors to black and white, colors="bw", does not allow the user to modify the character string in the title of the legend in legend.title. ...