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.
5,005
questions
0
votes
1
answer
19
views
Highcharts - Position the legend navigation to right
I have a chart with legends. but when legend items count goes big, then legend navigation automatically appears at the bottom of legends.
Any way using which I can position the legend navigation ...
-1
votes
0
answers
37
views
Print label of plot in latex formatted plain code (strings only!)
I am persistently trying to output a string on a label of a plot, which should display in the legend something like:
$0.5\cdot\tilde{t}$
(Note: NOT the Latex shown text, but exactly this in strings)
...
0
votes
1
answer
28
views
creating a scatter legend size with range 0-100 no matter what the range of the data
I am having trouble with creating a matplotlib scatter plot with a legend showing the size diameter of points. The problem is with the scatter_plot.legend_elements function.
The problem is I want to ...
0
votes
1
answer
29
views
Improve presentation of logistic regression plot R ggplot2
It's my first time asking a question. I hope it is ok.
Minimum reproducible example:plot
library(tidyverse)
OR <- c(0.98, 1.02, 1.00, 1.03)
conf.low <- c(0.64, 0.69, 0.65, 0.68)
conf.high <- ...
0
votes
1
answer
51
views
How to customize the color scatterplot legend handle [duplicate]
I have a seaborn scatterplot with datapoints distinguished by (1) color and (2) marker. This is the minimal code that generates the plot:
d = {'x': [1, 2, 3, 4], 'y': [2,4,6,8], 'Set': ["Set 1&...
0
votes
0
answers
16
views
searborn plot write legend on x-axis [duplicate]
I want to plot a barplot using seaborn where I have given x, y and hue. My problem is that hue is shown as legend. I want to show the hue on the a-axis itself. Is there any means to do so?
Using the ...
1
vote
1
answer
41
views
How do I add a legend indicating significance levels below a ggplot object?
I'm using ggforestplot() to plot the results from my several regression models where some of the data have been imputed with mice(). But for the sake of this MWE, I will use the example data of the ...
-1
votes
2
answers
39
views
How to put legend outside the plot for a for 2 column plot definition? [duplicate]
I am trying to plot the legend outside a 2 columns 5 rows, but in this MWE 2 rows example in matplotlib. Turns out the legend to "lower center" puts the space between the two plots as well, ...
0
votes
0
answers
25
views
How to enable Legend picking with a scatter plot
The following example from the matplotlib doc shows how to make a legend "pickable", such that you can toggle the lines visibility by clicking on their legend:
import numpy as np
import ...
1
vote
1
answer
32
views
How to remove the square surrounding legend keys in a plot made by plot_model (ggplot) in R
I'm currently working on creating some complex visualizations using the plot_model function from the sjPlot package in R. Specifically, I'm dealing with interaction plots of linear models, and I'm ...
0
votes
2
answers
25
views
How to show seperate legend for two geom_col with same aestetics
I'm trying to plot overlapping stacked bar charts with the same aestetics and different widths of the bars.
My current solution is by adding separate geom_cols, but the same aestetics. Just different ...
0
votes
1
answer
25
views
Custom legend in Highcharts Variwide
Based on an existing sample, I have added a custom legend on a Highcharts Variwide chart.
The legend works very well! Result is visible here : https://jsfiddle.net/vegaelce/d4mrnu2h/
The only next ...
1
vote
1
answer
18
views
ggplot2 transparent/white legend key with stat_ellipse
I've got a plot where I'm using stat_ellipse to show 95% confidence ellipses around some points. I'd like to get rid of the grey background behind the points in the legend, but it's just not working. ...
1
vote
1
answer
41
views
How to customize the handles and labels for a legend
I am trying to customize the ax from matplotlib plot. Here I am using a surpyval package to fit the data and then plot it. The plot method in surpyval package does not accept arguments other than the ...
0
votes
2
answers
73
views
How to fix the legend of plotly 3D scatter plots in Python?
I am trying to create some 3D scatter plots using plotly in Python. I have a data frame with some personality traits and cluster labels, and I want to plot the TSNE embeddings for each trait using ...
-1
votes
1
answer
31
views
How can I give different labels? [duplicate]
I'm comparing the solutions of differential equations using two methods of solving: the analytical and numerical solutions. I would like to label to solid lines with 'Analitical Solution', the dotted ...
-1
votes
0
answers
46
views
How can I edit pandas plot colorbar ticks so that they only show whole numbers?
I'm creating maps with a corresponding legend for the visualized variable. The variable is a count that increments in whole positive numbers (e.g., 0, 1, 2, 3, 4... etc.). The color bar ticks I have ...
-1
votes
0
answers
21
views
How to edit the items in legend on a pandas .plot.bar() function? [duplicate]
I am trying to change the legend on this bar chart from numbers into the months of the year but I want to keep the months ordered (i.e. from January to December).
This is what I've tried and the ...
1
vote
1
answer
18
views
Adding a legend in Highcharts sunburst
I'm trying to add a dynamic legend in a Highcharts sunburst (like in the pie chart).
The code presented in the following fiddle is exactly what I need : https://jsfiddle.net/BlackLabel/x2hL8tqo/
My ...
1
vote
1
answer
16
views
How to position the legend at the bottom after adjusting plot.margin in ggplot2?
In ggplot2, I would like to increase the bottom plot margin (using the plot.margin argument of theme()) and position the legend at the bottom of the plot window.
Consider the following example code:
...
0
votes
0
answers
12
views
react-google-charts.com is that posible to add tootip on legend?
Title:react-google-charts.com is that posible to add tootip on legend ?
Title:react-google-charts.com is that posible to add tootip on legend ?
utl: https://www.react-google-charts.com/
code:
import ...
0
votes
1
answer
32
views
How to include bin size (value range) information in the legend of color/size of ggplot2 figure
Thanks to this post, I learned how to combine size and color information into a single legend using ggplot2.
Here, I have an additional question regarding the legend:
Below is the baseline plot.
...
0
votes
1
answer
28
views
Separate out overlapping legend items ggplot()
The Issue
I have a plot that has various lines and symbols. They are all coloured by location ID. This has resulted in the legend items overlapping.
i.e.
There are four symbols: circle, triangle, ...
1
vote
1
answer
35
views
Creating Separate Legend for Specific Line in ggplot2
I'm working on a data visualization project in R using the ggplot2 package. I have a bar plot with two bars per year and a trend line that applies to one of the bars. I'm trying to create a clear ...
0
votes
1
answer
30
views
How to change the aesthetics of the legend when using plot_model in R?
I am currently using plot_model to plot a binomial generalized linear mixed effects model from an AIC model selection process. Overall, plot_model works well, but I am having trouble customizing the ...
1
vote
0
answers
62
views
Customizing heatmap colorbar and adding legend
On my heatmap using Matplotlib to display different scores of animals across different days, X-axis represents days, Y-axis animal ID's, and the value in each cell signifies score. Time points with no ...
0
votes
1
answer
20
views
ggplot formatting a complex legend
I'm trying to make up a legend with multiple elements of points and lines. There are point data and a number of reference lines. A simple mock-up example is below.
require(tidyverse)
df <- iris %&...
0
votes
0
answers
21
views
Order histogram plotly express legend alphabetically or according to the value presented in the y-axis
I have a question about the legend of a histogram made through plotly express.
Is there a way to sort alphabetically or according to the value presented in the y-axis the data that appears in the ...
0
votes
0
answers
18
views
Default Dot is not showing in tooltip chart.js line type with labels
I have multiple line type charts in charjs. All is good but It is showing dot with label in the tooltip like I have in legends. I have added multiple options in the tooltip object but no one is ...
0
votes
1
answer
29
views
Using ggpattern with white pattern; fill and pattern different variables: How do I add a grey background to the pattern legend?
I am working on a graph and am using color and pattern for two different variables. I want the graph to have colored designs created by using a white pattern over the colored fills. (I tried making ...
0
votes
0
answers
23
views
R - making emdash among negative values when labelling discrete bins
I'm cutting a dataframe shp into discrete bins, some of which are negative values. I'm wondering how I can make an em dash in between negative values (e.g. "0 - -2.5") for the labels to ...
0
votes
0
answers
27
views
ggplot2 line always pink in R
I am trying to create some vizualizations with ggplot2 in R but the colors don't match what is in my code and the legend. One line is always pink.
Here is my code:
point = format_format(big.mark = &...
1
vote
1
answer
51
views
how to manage legend_tracegroupgap for different row_heights in subplots in plotly?
i found this example code for subplot with legend at each subplot. i changed it by adding row_heights and now the legend do not fit to the subplots.
import pandas as pd
import plotly.express as px
df ...
0
votes
0
answers
28
views
How can I generate a legend with color, shape, and lines manually in R
I'm mapping and I can't make the legend become unified.
This is my code:
ggplot() +
geom_sf(data = all_boundaries$osm_multipolygons,
inherit.aes = TRUE,
color = "...
0
votes
0
answers
11
views
How do I add a legend to ggplot2 which just gives the colour of different column labels? [duplicate]
I am trying to plot several different columns against the same x using ggplot. I have produced a plot with the lines as required, but can't work out how to add a legend linking each column title to ...
0
votes
0
answers
19
views
How to add a legend on a plot with multiple dataset with ggplot2 through R? [duplicate]
gfg_plot <- ggplot(NULL, aes(x = Area, y = Richness, fill = District )) +
geom_point(data=District1, col="blue") +
geom_point(data=District2, col="black")+
geom_point(data=...
1
vote
0
answers
42
views
Display fill legend as smudges of colors instead of using pre-defined shapes in ggplot
Let's say I have this dataframe df:
df <- structure(list(Fruit = c("Apple", "Orange", "Graphe", "Apple",
"Orange", "Graphe", "Apple&...
0
votes
0
answers
34
views
How do I create a simple folium map legend based on the marker colors and values?
I have a folium map with three different colored markers which are based on cluster_labels from three bins:
df['cluster_label'] = pd.cut(df['column1'], 3, retbins=True, labels=[0,1,2])[0]
colors = ['...
0
votes
1
answer
31
views
Add custom legend in ggplot map
I face difficulties to add a custom legend on the Sardinia Island map below. This legend should include both color lines (NUTS2 and NUTS3 borders) and color points which represent the initiation ...
0
votes
2
answers
47
views
ggplot - change legend labels without scale_fill_discrete
I am trying to change the labels of a legend manually, but it does not seem to work. From other questions, I think it is because i am using group instead of fill, but i don't know what to do about it.....
0
votes
2
answers
56
views
How to add legend when using twinx
I am trying to plot 2 values with same x axis values (time) but different y axis values. I am trying to add legend to the plot, however, I keep getting 2 legends for the same variable instead of one ...
0
votes
0
answers
8
views
Legend in base R plot changes line centering when both newline character and subscripts are present
I am trying to make a legend that includes both subscripts (e.g., expression(x[1])) and a long label that needs to go into a second line. When I include both, the subscripts print correctly but the ...
0
votes
0
answers
17
views
ggplot question : se=FALSE does not work to remove confidence interval from the caption
I am trying to do a plot with a regression line and cannot remove the confidence interval color from the fill caption.
ggplot(KF, aes(x = d18O, y = d66Zn)) +
facet_grid(. ~ Tissue) +
...
0
votes
1
answer
19
views
Create a legend on basis of the x-axis values in ggplot2
I have the following example code:
tmp <- data.frame("channel_topic" = LETTERS[seq(from = 1, to = 16)],
"n_group" = round(seq(from = 1600, to = 0, length.out = ...
0
votes
1
answer
37
views
Duplicated labels in the legend of Seaborn histplot
I am trying to generate a combined histplot with two datasets together with the following codes
_,bins = np.histogram([150, 600], bins=30)
alpha = 0.4
fig, ax = plt.subplots(1,1)
sns.histplot(df1['...
0
votes
0
answers
10
views
Pyoncoprint (matplotlib) legend not showing disappeared ty[es
I'm using such a marker from the example file of the package PyOncoprint:
rom matplotlib.patches import Polygon, Rectangle
mutation_markers = {
"Amplification": dict(
marker=&...
0
votes
1
answer
23
views
Why does my legend not move to empty area with patchwork using guide_area()
I have a plot 1 which covers the whole first row and a plot 2 which is a bit smaller below. They have a common guide and I arranged them using patchwork.
Now I want to move the guide to the right of ...
0
votes
1
answer
32
views
Trends spatial map in R
I wanna make a spatial map of trends, for that I am using my varaible called sen. I want to represent those values with points in a scale determined by the size of the points and if the value is ...
0
votes
1
answer
38
views
How to have legend for multiple stat_function
I am creating the following graphs
data <- runif(100, 15, 45)
df <- data.frame(data)
graph_parameter_product <- function(data_set, column_value, bin_width, title_value) {
graph <- ...
0
votes
1
answer
51
views
How to pass ids and names to d3 from rails
As with any rationalized database, the IDs, names and data are stored in separate tables. The current script (below) shows the IDs in the legend but I would like to pass in and show the names. The ...