Skip to main content

All Questions

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
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
2 answers
659 views

plot function in R producing legend without legend() being called

I'm trying to produce a cumulative incidence plot for a competing hazards survival analysis using plot() in R. For some reason, the plot that is produced has a legend that I have not called. The ...
gcgoobie's user avatar
0 votes
1 answer
499 views

Octave box legend not proper width with upper case text

I'm reading data from files and use the file's names as legend, but Octave not proper render the originals file's names (in upper case). This is my Octave script (with dummy plot data) files = dir('*....
gvd's user avatar
  • 1,552
0 votes
1 answer
2k views

Changing legend labels when using multiple variables

In R using ggplot: I'm trying to plot a line plot with multiple columns as individual variables. I'm not using a fill = parameter so I know that's why scale_fill_discrete doesn't work. From what I've ...
afab421's user avatar
  • 37
1 vote
1 answer
833 views

Changing the color of legend in plot for R

so I am hiving a minor issue here with my graph's legend. I can't seem to get "RCB Class 1,2 or 3" to show as a black dot instead of red. I am new to R and making graphs with R. Please help :) Image ...
Brian's user avatar
  • 31
1 vote
1 answer
372 views

How I fix the legend in a plot in R

I run the following code: plot(1:3, rnorm(3), pch = 1, lty = 1, type = "o", ylim=c(-2,2)) lines(1:3, rnorm(3), pch = 2, lty = 2, type="o") legend(1,-1,c("group A", "group B"), pch = c(1,2), lty = c(1,...
hernando2011's user avatar
4 votes
3 answers
210 views

Legend; text/description before key/colour?

By default MATLAB puts the text part of a legend entry after the sample of what is used in the plot. Is there any way to reverse this? For example, using the below code the first entry in the legend ...
Steve's user avatar
  • 634
3 votes
1 answer
685 views

How to add legend elements in Matlab in the plot itself

I want to somehow label vertical lines in Matlab. I could imagine two options: Either by having legend entries right next to each vertical line itself, or by having the vertical lines numbered in the ...
LenaH's user avatar
  • 323
2 votes
1 answer
2k views

Reorder legend items in bokeh

In the example from the documentation from bokeh.io import show from bokeh.models import ColumnDataSource from bokeh.palettes import RdBu3 from bokeh.plotting import figure c1 = RdBu3[2] # red c2 = ...
Antony Hatchkins's user avatar
-1 votes
1 answer
725 views

How do I plot a function in python that looks like the one in the picture?

I need to plot this graph (exactly as in the picture). It is sin and cos of x, where x are equally spaced 100 numbers between 0 and 2 pi. So far, I wrote x=np.linspace(0, 2*math.pi,100) import ...
huda95x's user avatar
  • 149
2 votes
1 answer
1k views

How to combine filled squares and plot symbols in a legend in R?

I made a boxplot and added the mean as a point. In the legend I'd like to put the filled squares corresponding to the boxes. Nest to the boxes I want to add a symbol corresponding to the mean. However,...
Daniel Valencia C.'s user avatar
13 votes
2 answers
17k views

How to add a legend for two geom layers in one ggplot2 plot?

I've got a data frame that looks like this: glimpse(spottingIntensityByMonth) # Observations: 27 # Variables: 3 # $ yearMonth <dttm> 2015-05-01, 2015-06-01, 2015-07-01, 2015-08-01, 2015-09-01, ...
hpy's user avatar
  • 2,101
2 votes
2 answers
97 views

Putting one legend for many axes

I'm using three axes-Objects to scale my data on the x-axis. My problem is that i do not know how to get a nice legend for the three plots. I have to do this cause my real data is sampled with ...
himynameis's user avatar
1 vote
2 answers
3k views

Legends overlapping the plots in Rstudio

I am trying to plot an image and then overlay a legend on its top. The legend is covering the plot and I am not able to adjust it using different parameters like cex, lty, etc. plot(cov16_2ms04h$...
everestial's user avatar
  • 7,115

15 30 50 per page