Skip to main content
Filter by
Sorted by
Tagged with
6 votes
1 answer
96 views

I am trying to customize the behavior of a horizontal legend in Plotly.js for varying viewport widths. Minimal example: <head> <script src="https://cdn.plot.ly/plotly-latest.min.js&...
user31792702's user avatar
2 votes
1 answer
63 views

I would like the legend to my scatter/line plot to be inside the axis of the plot it is informing, but I can only seem to get a legend if is has its own axis, which becomes a problem when I want three ...
Anna's user avatar
  • 25
0 votes
1 answer
51 views

I want to plot points in ggplot2 with colors mapped to a variable (director), but I don’t want a legend for the points. At the same time, I have a line (geom_smooth) colored by another variable (...
Winston Castorp's user avatar
0 votes
0 answers
103 views

I can't get legend labels to show up when I use 'CONDITION' (a longer string) as my x data and hue, however when I use CONDITION_N (a shorter string) as the hue then it appears. Why? Warning: /var/...
Sarah Warner's user avatar
2 votes
2 answers
129 views

I wish to reverse the order in which the items in the auto.key-generated legend of my bar chart are displayed so they are in the same order as the items in the bar chart. I have tried adding "...
Seth W. Bigelow's user avatar
0 votes
0 answers
55 views

I came across a unique colorbar in an article, but the author didn't include the code. It seems to incorporate some features of ggplot2, but how is this two-ended, interrupted triangle drawn? Does ...
Breeze's user avatar
  • 586
0 votes
0 answers
40 views

I have a line chart built in chart.js 3.7. The legend items at most screen widths need to overflow into a second line. However, this only happens about 50% of the time the chart loads. The first image ...
katecharts's user avatar
1 vote
1 answer
70 views

I am trying to get the following legend: "towns" as yellow triangles "islands" as green circles of different size depending on... well "size" (actually population size) ...
Fiona's user avatar
  • 35
0 votes
0 answers
69 views

I've created a Pine Script indicator with a custom pane background colour using bgcolor(). The background displays correctly, but the indicator legend area (showing indicator name and values) has its ...
paul28's user avatar
  • 21
6 votes
1 answer
145 views

I have created the first figure using legend normally. I would like to have more than one dot in the legend, so the colours are easier to recognize there, as in the second figure (which I created ...
Luis Mendo's user avatar
  • 113k
2 votes
2 answers
107 views

I create a plot with seaborn that has several lines and error bands. In the legend, I only want to show some of the labels and hide others. Previously, it was possible to call ax.legend(['one', '_', '...
skjerns's user avatar
  • 2,270
3 votes
1 answer
120 views

I’m using Plotly to create some subplots, where I have several vertical lines and shapes that I want to toggle at the same time. The vertical lines were plotted using traces, so the legendgroup worked ...
Lobna Hisham Eldeeb's user avatar
3 votes
1 answer
77 views

I have a legend for a ggplot chart that spans two rows with several short values and one long value: legend over two rows Currently legend 'fills' by column then by row, causing the wrapping to mess ...
user29792873's user avatar
0 votes
2 answers
101 views

I have 3 plots that I want to arrange in a 2x2 format. They all share the same legend, and I want to place the legend in the bottom right space, where a fourth figure would fit. So far, I have tried ...
Gabriel's user avatar
  • 81
2 votes
3 answers
103 views

reset set encoding utf8 set terminal pdfcairo size 20cm,20cm font "STIX Two Math, 22" enhanced set output "straight-lines.pdf" # set grid linetype 0 linewidth 1 dashtype 3 ...
chandra's user avatar
  • 353
3 votes
2 answers
134 views

I need to use colours and patterns independently to properly display my data, for this I use geom_col_pattern(). The issue I have is that in the legend the background is so dark, that the pattern is ...
Becci's user avatar
  • 57
2 votes
2 answers
59 views

I have a function that is supposed to enlarge all labels in a figure to make it ready for export. However I fail to enlarge the legend properly: import matplotlib.pyplot as plt def enlarge_legend(ax, ...
Galedon's user avatar
  • 398
0 votes
0 answers
52 views

I have a dataframe (df) with two y-axis columns (numeric, A and B), three x-axis columns (K, L, M), and a label (string) column. Column M is also used to color-code the data points. It is discrete (i....
TheorVHP's user avatar
2 votes
1 answer
74 views

When I use expression() to add text formatting such as italics and subscripts to a tmap legend, I'm getting huge amounts of unnecessary white space, and I have no idea why. Here's my reprex code; ...
Chris Shipway's user avatar
1 vote
2 answers
117 views

I have a bar plot where I am using ggpattern to assign patterns to the columns. However, I would like only some of the columns (chosen arbitrarily) to have patterns. To do so, I am assigning values ...
gitcanzo's user avatar
  • 143
0 votes
1 answer
85 views

I first converted my continuous data into discrete data, then plotted a bubble chart. Color represents intensity, and size represents duration.When I plot a bubble chart using discrete data, the ...
Ruijie Wang's user avatar
0 votes
2 answers
223 views

I am trying to make a plot that combines bars with points (of different colors and shapes). Therefore, I need to combine fill, color and shape in the same legend. I am close to my desired result, ...
gitcanzo's user avatar
  • 143
0 votes
1 answer
57 views

I am trying to increase the size of the margins of a common legend built when using ggarrange. I could increase the width of the plot, but I do not really want to do that. What do you suggest? ...
CafféSospeso's user avatar
1 vote
0 answers
22 views

My ggplot chart has two different data frames depicted by lines, see code below. I cannot add a legend to it. What I am doing wrong here? Thanks! library(ggplot) df1 <- data.frame(YEAR=c(1990:2025)...
Alex's user avatar
  • 183
-1 votes
1 answer
42 views

My plot is almost perfect. But ggsurvplot_facet doesn't seem to work like ggplot (I've made this work in basic ggplot before), and it's been giving me endless problems. I want to have only one ...
Teagan P's user avatar
2 votes
1 answer
103 views

I have a GeoDataFrame I want to plot. This works fine, however somehow I cannot easily plot its legend. I have tried a number of alternatives and checked solutions from googling and LLM, but I do not ...
Zorglub29's user avatar
  • 9,399
1 vote
1 answer
74 views

My script generates a composite plot, made of dozens of lines and line segments. I am trying to add a custom legend to the plot, which contains just 3 of those lines, but I don't seem to be able to ...
ysap's user avatar
  • 8,241
2 votes
2 answers
84 views

I am running into some trouble trying to fix what I have prescribed using theme(), followed by theme_grey(). For instance, if I were to set ggplot() + theme(legend.position = "bottom") + ...
Chong Kai 's user avatar
0 votes
1 answer
78 views

I am struggling to place the title inside the frame of the legend, but on top of the legend and not below. Any guidance or working examples would be greatly appreciated! Thank you. The online help isn'...
Mirc's user avatar
  • 33
0 votes
0 answers
69 views

I have this plot with horizontal legend. I want the legend title to be on the right instead of the left, and I want the bullets of each legend item to be on the right of the name instead of on the ...
Free Palestine's user avatar
1 vote
1 answer
57 views

I am plotting a dataset using a scatter plot in Python, and I am encoding the data both in color and size. I'd like for the legend to represent this. I am aware of .legend_elements(prop='sizes') but I ...
MBR's user avatar
  • 848
2 votes
1 answer
58 views

I want to plot a dataset and then overlay a subset of the dataset in grey. I am using ggnewscale to colour the subset differently. The plot is as desired but I would like to remove the legend with ...
user17213841's user avatar
0 votes
0 answers
96 views

I am trying to create a panel of scatterplots displaying different subsections of the same dataset. I want to combine all of their legends, but because of the subsetting, no individual plot contains ...
Chris Shipway's user avatar
1 vote
1 answer
98 views

I have defined a list of 5 colours, which I use to colour the markers in the go.Scatter plot below. I want the colour bar (legend) to show these discrete values, but the resulting colour bar stays ...
MuhammedYunus's user avatar
0 votes
1 answer
122 views

I’ve created a shiny app with raster layers plotted over a leaflet map. The user selects which raster to show with two drop down menus: one to select the type of data (mean or SD) the other to select ...
erz's user avatar
  • 3
0 votes
1 answer
90 views

ggplot changed how it handles levels with no data and I can't get the plot I want the third plot shows the unused level in the legend but has no point I would like to generate the third plot so that ...
KJB's user avatar
  • 141
1 vote
1 answer
45 views

Does anyone know the main purpose of the parameter legend.axis.line? Feel similar to legend.ticks? And I can't seem to find a use for it yet. In which case would it be used? ggplot(mtcars, aes(x = cyl,...
Breeze's user avatar
  • 586
2 votes
0 answers
41 views

I would like to do two figures, coming from the same dataframe, with a shared legend. The main goal is to be able to have one single legend for both plots and to hide data with the click_policy='hide' ...
Sara.SP92's user avatar
  • 113
2 votes
1 answer
118 views

I am making a multi-panel figure in R using wrap_plots from the patchwork package, and I'd like to have the final plot show a common legend for point shape and color, but have each plot keep its own ...
millie0725's user avatar
0 votes
2 answers
106 views

I want to place a legend inside a ggplot2 graph. See for example the code ggplot(iris, aes(Sepal.Length, Petal.Width, shape = Species, colour = Species)) + geom_point() + theme(legend.position....
Seth W. Bigelow's user avatar
0 votes
3 answers
96 views

I added these custom legends in the attached plot, but it has a weird space in front of the text. Is there a way I can remove the empty space? Code: # Plotting plt.figure(figsize=(7, 5)) # Set figure ...
LalaLand's user avatar
  • 159
0 votes
0 answers
10 views

I have a graph with yearly series like "2023, 2024, 2025, 2025 forecast". In the legend, I would like to hide the last item (i.e. 2025 forecast), but the serie to remain printed. How can I ...
OuzoPower's user avatar
  • 278
2 votes
2 answers
67 views

Let's say I need to plot two sets ("types") of data with the same units, where each type has a group a and group b. I want group (a,b) to correspond to color, but I want the type (A, B) to ...
Michael Roswell's user avatar
0 votes
0 answers
49 views

I am doing a linear interpolation using ggplot2, with two series which generates a legend, reporting Primer A and Primer B. On the legend appears a strange a on the left of the symbol which I am not ...
GiacomoDB's user avatar
  • 491
0 votes
1 answer
45 views

I'm trying to sort legend entries across both ggplot and ggpattern items. The map will not always include all the layers, so the legend should be dynamic - only showing legend items for those layers ...
mmoore's user avatar
  • 187
0 votes
1 answer
55 views

I am creating a series of species range maps. In some cases, there will be overlapping features for species that occur in different seasons. So far, the best way I have found to represent this is with ...
mmoore's user avatar
  • 187
1 vote
0 answers
74 views

About two years ago the following code was working without error: F(q,r):=3*r^2 + 5*q; wxplot2d(F(1,r),[r,0,5],[legend,"F"],[xlabel,"r[bohr]"], [ylabel,"denso"]); Now ...
Alby Stalks's user avatar
2 votes
1 answer
32 views

When I move the legend of a Seaborn plot from its default position to the top of the plot, I want to have the variable (hue) name in the same row as the possible variable values. Starting from this ...
Nico's user avatar
  • 103
4 votes
1 answer
110 views

I want to add a legend of p value significance to my plot, which is added using stat_pvalue_manual. The label is not part of any aesthetic mappings. Here is some mock code: stat.df <- data.frame(...
Ian's user avatar
  • 89
0 votes
1 answer
83 views

This happens a lot to draw a ggplot with multiple aesthetic all referring to one variable. Then, to change the common legend title, the simple way I know is to do it for all common aesthetics using ...
Mohammad's user avatar

1
2 3 4 5
104