Skip to main content

All Questions

1 vote
1 answer
37 views

How to change legend key shape for ggtree [closed]

I am working with a ggtree plot. The data used is available here. Load required packages #load libraries pacman::p_load( here, dplyr, googlesheets4, ...
Blundering Ecologist's user avatar
0 votes
0 answers
29 views

How to plot the legend with combined_plot (ggplot2)

I created this script to display some environmental impacts for my research. `legend_plot <- ggplot(data_longGW, aes(x = Crop_cycleGW, y = kg_CO2_eq, fill = Category)) + geom_bar(stat = "...
Guido Evangelista's user avatar
1 vote
1 answer
29 views

Showing or saving only the legend of a plotly figure

Given a plotly figure with traces and a legend, is there a way to only show the legend without any of the plot content? My use case for this: I'm exporting several images with the same legend. Instead ...
william_grisaitis's user avatar
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
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
0 votes
1 answer
56 views

Force keys size to be smaller in multiple lines legend in ggplot

Is there any way to force legend key sizes to be independent from line height when we have legend text with multiple lines? I tried legend.key.height, ggtext::element_textbox_simple, and guides but ...
rez's user avatar
  • 338
0 votes
2 answers
61 views

legend in bokeh UMAP shows only one entry

Hi there I just managed to get this plot done in bokeh, so I imagine there are many things that could be improved. Nonetheless, what bothers me the most is that I cannot figure out how to have all ...
Matteo's user avatar
  • 209
1 vote
1 answer
80 views

plotly title_side position not working properly

I'm greenhand with Python plots but I was trying to do a PCA for different human populations; while I'm still working on the actual data, the main issue I'm having with visualizations in Python, as ...
Matteo's user avatar
  • 209
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 ...
Aishwarya's user avatar
-1 votes
2 answers
1k 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, ...
theprogressor's user avatar
1 vote
1 answer
228 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 ...
A.E's user avatar
  • 1,013
0 votes
1 answer
83 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, ...
Melanie Baker's user avatar
0 votes
1 answer
517 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 ...
Elizabeth W's user avatar
0 votes
0 answers
75 views

How do I extract the shape of scatterplot legend entries?

I am trying to make a seaborn scatterplot with legend entries that combine color and shape. Rather than extract color and assign that to the shape entries like here, I want to extract the shape ...
Aristle Monteiro's user avatar
1 vote
1 answer
196 views

get legend labels (text) from ggplot

I am trying to extract the label text from a ggplot legend object, e.g. for this plot: library(ggplot2) (p <- ggplot(mtcars, aes(x=mpg, y=disp, color=as.character(cyl))) + geom_point()) I can ...
MartijnVanAttekum's user avatar
1 vote
1 answer
36 views

How can I match the colors of lines and legend entries in ggplot2?

I have a dataframe of some spectra (one x-value, several y-values) and want to plot them in one graph. For this purpose, I want to use ggplot. After some research, I found a way to do so, but I want ...
Excelsior's user avatar
  • 181
0 votes
0 answers
283 views

How to deal with long legend labels when using multiple columns

It is necessary that the legend element can occupy several columns so that the legend does not stretch. It should work at any ncol value. If you increase the length of the word "Some Line", ...
hesoyami's user avatar
0 votes
1 answer
76 views

Related to legends for subplots in plotly

I have created the 4 subplots with the legends showing on right sideWhen I create subplots in plotly , legends are created either in right side or in the bottom of all subplots. But how can I get ...
Rajesh Koyi's user avatar
0 votes
1 answer
212 views

How can I create a custom arrow-shaped legend key

I'm creating a plot using Matplotlib. I want the legend keys (the shapes next to the descriptive text in the legend) to be arrows similar to the ones present in the figure. I've been able to get an ...
Porter's user avatar
  • 3
3 votes
2 answers
273 views

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 ...
hnguyen's user avatar
  • 804
0 votes
1 answer
80 views

Amchart 4 Legend In Arabic not Showing Properly

I want To start the Legend marker from the right side I already used these three Properties. chart.legend.reverseOrder = true; chart.legend.itemContainers.template.reverseOrder = true;chart.rtl = true;...
wajiha siddiqui's user avatar
0 votes
0 answers
34 views

EXTJS Piecharts are not showing legend for dynamic data

Hello I have 2 pie charts one with static data and one with dynamic. The static piechart shows the legend however the dynamic one doesnt. Its the same code for both one. Both have the same fields from ...
Jack's user avatar
  • 1
1 vote
3 answers
160 views

Changing legend symbols in ggplot2

I have this plot made in ggplot2 With the following code: colors4 <- c("Exp" = "#000000", "TL 1" = "#56B4E9", "TL 2"="#CC79A7", "TL ...
David Moldes's user avatar
0 votes
1 answer
259 views

R survminer::ggsurvplot duplicates legend when setting linetype

Reproducible example: require(Survival) require(survminer) require(ggplot2) set.seed(42) a <- c(32,291,545, 44,3,792,352, 20,615,169, 61,156, 88,863,255, 33,132,5, 63,8,964,831, 55,133, 12,...
Reader 123's user avatar
0 votes
1 answer
291 views

Problem with handling multiple legends in subplots when you use plt.twinx()

I'm struggling to pass the list of my subplots with different scales on sides using plt.twinx() in each subplot to show all labels in a single legend box, but I get the following error: ...
Mario's user avatar
  • 1,821
0 votes
1 answer
332 views

How to avoid data disappearing from graph when click on the legend - React ECharts

I am trying to avoid the default click behavior on the legend of React ECharts. When the user click on any legend item, the corresponding plotted data disappear from the graph until the user click on ...
user2403607's user avatar
0 votes
1 answer
175 views

Adjust spacing between 2 markers of same line displayed in the legend of matplotlib plot

I am plotting 2 markers of the same line using the following code and I want to adjust the spacing between two markers in the legend. Code : ref. import matplotlib.pyplot as plt from matplotlib....
Natasha's user avatar
  • 1,431
0 votes
1 answer
60 views

Only one legends shows up: multiple legends in ggplot with different data types

I am trying to make a boxplot of 2 different beta coefficients (returned from a model) from two groups of categories and I want to overlay the "true parameterized" beta coefficient on top of ...
Jade131621's user avatar
0 votes
1 answer
38 views

R ggplot mixed legend of two legends

Here is the graph that I have as a basis: color_two_groups_type_2 <- c("dark red", "black") pd <- position_dodge(0.4) hedonic_price_indices %>% ggplot(aes(x=year, y=index,...
SCW16's user avatar
  • 413
1 vote
0 answers
201 views

Make legend horizontal and reduce the size in Plotly Dash

I am trying to make the attached legend horizontal and smaller in size but it's not working. Also if you see the Plot is hidden below the legend. (Some states are not visible) How can I set that to ...
Himanshu Joshi's user avatar
1 vote
1 answer
2k views

Legend in geopandas plot for color as well as for markersize

I am creating a geopandas plot in which I have colors dependent on a column value and the markersize on another column value. When I put legend= True the plot only shows the colors in the legend and ...
Dante van der Heijden's user avatar
2 votes
1 answer
746 views

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'...
Jade131621's user avatar
0 votes
0 answers
154 views

matplolib legend elements bold: font size too big

I have a plot and would like to have some things in my legend bold. Unfortunately if I do this then the font size of the bold text is bigger than that of the rest. How can I keep the font size the ...
corianne1234's user avatar
0 votes
1 answer
96 views

anchor two legends for the same plot in line one line

I have a plot with two legends that are not of the same height. I would like to place them such that their titles start at the same place on the y-axis. I know I could go and manually change ...
corianne1234's user avatar
-1 votes
2 answers
40 views

Can any one help me fix this legend issue?

Can any expert help me merge the following legend? I would like all the two legends to be merged Can any expert help me merge the following legend? I would like all the two legends to be merged def ...
agyengo44's user avatar
2 votes
1 answer
659 views

Add text to legend symbols in ggplot

Using geom_rect I am separating my data into classes in a ggplot. These classes (v high, high, medium, low, v low) are denoted in the legend. Is there a possibility to add the lower and upper limits ...
Lisa P's user avatar
  • 21
2 votes
1 answer
4k views

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=...
Metrics_Hannah's user avatar
1 vote
1 answer
1k views

Add linetype to geom_segment legend

Aim: add the linetypes of the segments to the legend, as well as the colour. Problem: only the colour is showing. Data: m = as.data.frame(matrix(c(1:10), ncol = 2, nrow = 10)) Plot: ggplot(m, aes(v1,...
Paul's user avatar
  • 45
1 vote
1 answer
2k views

How to make alpha (transparency) appear as continuous gradient in the ggplot legend?

Is it possible to make the transparency (alpha) appear as a continuous gradient in the ggplot legend? Currently, the plot looks like this: Here, the different values for alpha are represented by dots ...
Peter Jordanson's user avatar
0 votes
1 answer
1k views

How to plot a barplot with different hatch and edge color with legends using matplotlib?

I would like to plot a barplot where bars have a different hatch and edge color using Matplotlib with its proper legends. I tried to plot but I couldn't generate proper legends with this code: import ...
Kamran Ansari's user avatar
1 vote
0 answers
340 views

Leaflet legend with subtitles for grouped values

Is there a way to add subtitles to leaflet legends? The following example produces a functioning legend. However, is there a way to combine the subgroups to the same legend? I could imagine this could ...
Beni's user avatar
  • 251
1 vote
1 answer
890 views

Adding multiple legends to multiple subplots

I am trying to display multiple legends within multiple subplots. Currently, I am able to create figures with subplots and display multiple legends within one plot but can't combine the two. They seem ...
sunnyklein1's user avatar
0 votes
1 answer
90 views

Multiple Data Frame Plot Custom Legend and X Axis Breaks?

The data is 1965-2019 Renewable Energy Vs Alternative Energy Sources. I have two issues I am trying to tackle here. I would like to 1) Add a custom legend signifying the two colors and naming them ...
Samh200's user avatar
  • 13
0 votes
1 answer
1k views

How to specify ggplot legend order when you have multiple variables that are not all part of one column?

I'm plotting the same data by different time scales (Week, Month, Quarter, etc.) using ggplot, and as a result, I'm pulling the data from different columns. However, when I see my legend, I want it to ...
J.Sabree's user avatar
  • 2,432
2 votes
2 answers
1k views

How to change the font family of matplotlib legend AND legend title?

I would like to use the font family "Consolas" in my matplotlib legend in order to benefit the monospaced font. I also want a legend title. But it seems that when I change the font family of ...
Samovian's user avatar
  • 215
0 votes
1 answer
464 views

How to avoid overlapping and stack long text legends in D3 graph?

I have D3 graph base on Multi-line graph 3 with v7: Legend, this sample contains few and shorts legends for the graph. In my sample I want to increase the length for legends and stack the data if is ...
Tabares's user avatar
  • 4,247
2 votes
1 answer
12k views

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's user avatar
  • 233
4 votes
2 answers
14k views

How can I put different legends to subplots in plotly?

I am still designing what kind of plot with subplots I want to do but when we see the example in the documentation Multiple Subplots with Titles we have from plotly.subplots import make_subplots ...
KansaiRobot's user avatar
  • 9,103
0 votes
0 answers
386 views

Plotting a legend using legend(x,y ....) but x axis are dates in R

I'm trying to put a legend on a line graph using legend(x,y, legend=c("","").... etc. I've changed the date to numeric data and used that for x and it plots, so I know the rest of ...
Jack's user avatar
  • 3
0 votes
1 answer
2k views

ggplot box plot with data points: how to control legend appearance?

I tried various options, but I cannot find a way to achieve custom legend appearance (unless I export the figure to power point and edit it there...). I would like the legend to look like in the image ...
user7395965's user avatar

15 30 50 per page
1
2 3 4 5 6