legend

Use sub-/superscript and special characters in legend texts of R plots

谁说胖子不能爱 提交于 2019-12-09 10:43:57
问题 I generate a plot for multiple datasets. Each of the datasets should get it's own legend, which might contain greek letters, plotmath symbols or sub and superscrition. I'd like to generate the legend-texts in a loop. Bquote works fine, if there is only one legend text. If I try to add additinal legend texts, the plotmath-commads get lost,... x <- 0:10 y1 = x * x y2 = x * 10 plot (1,1, type="n", xlab=bquote(Omega), ylab="Y", las=1, xlim=range(x), ylim=range(y1, y2)) lines(x, y1, col=1, pch=1,

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

江枫思渺然 提交于 2019-12-09 06:40:07
问题 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, 2015-10-01, 2... # $ nClassificationsPerDayPerSpotter <dbl> 3.322581, 13.212500, 13.621701, 6.194700, 18.127778, 12.539589, 8.659722, ... # $ nSpotters <int> 8, 8, 22, 28, 24, 22, 24, 27, 25, 29, 32, 32, 21, 14, 18, 13, 20, 19, 15, ... I am trying to plot it with ggplot2 like so: ggplot() + geom_col

Superscript R squared for legend

拥有回忆 提交于 2019-12-09 06:24:33
问题 I want to write a R-squared term for my legend but I do not know how. Could someone help me please? My legend syntax is: legend(2,10, c("BW (MPE=3%, R-squared=0.77)", "MY (MPE=5%, R-squared=0.80)", pch=c(2,3)) I would liek to express R-squared as R2 as we normally have in the text. 回答1: It will work if you combine bquote and as.expression : plot(1:10) legend(2, 10, c(as.expression(bquote("BW (MPE = 3%," ~ R^2 ~ "= 0.77)")), as.expression(bquote("MY (MPE = 5%," ~ R^2 ~ "= 0.80)"))), pch=c(2,3)

How to make two markers share the same label in the legend using matplotlib?

久未见 提交于 2019-12-09 05:47:25
问题 What I want is like this: What I get is this: So how to merge the markers into one label? also for the lines, for the lines, of course, u can realize it by not assigning label to the second line while using the same linetype, but for the markers, you can not, since they are of different shapes. 回答1: I think it's best to use a full legend - otherwise, how will your readers know the difference between the two models, or the two datasets? I would do it this way: But, if you really want to do it

JQPlot Legend outside of graph

别等时光非礼了梦想. 提交于 2019-12-09 05:46:11
问题 I am using JQPlot and I have many graphs on one HTML page. Each of the graphs has the same legend. My question is this: Is it possible to display a legend totally outside of the graph with its own position on the HTML page or in its own div? 回答1: legend:{ show:true, renderer: $.jqplot.EnhancedLegendRenderer, location: 's' , placement : "outside", marginTop : "30px", rendererOptions: { numberRows: 1 } }, You can use placement : "outside" like in the above code. And you can move it using

Matplotlib: Adjust legend location/position

耗尽温柔 提交于 2019-12-09 04:41:02
问题 I'm creating a figure with multiple subplots. One of these subplots is giving me some trouble, as none of the axes corners or centers are free (or can be freed up) for placing the legend. What I'd like to do is to have the legend placed somewhere in between the 'upper left' and 'center left' locations, while keeping the padding between it and the y-axis equal to the legends in the other subplots (that are placed using one of the predefined legend location keywords). I know I can specify a

Move and resize legends-box in matplotlib

浪尽此生 提交于 2019-12-09 00:30:30
问题 I'm creating plots using Matplotlib that I save as SVG, export to .pdf + .pdf_tex using Inkscape, and include the .pdf_tex-file in a LaTeX document. This means that I can input LaTeX-commands in titles, legends etc., giving an image like this which renders like this when I use it in my LaTeX document. Notice that the font for the numbers on the axes change, and the LaTeX-code in the legend is compiled: Code for the plot (how to export to SVG not shown here, but can be shown on request):

R-plot a centered legend at outer margins of multiple plots

你离开我真会死。 提交于 2019-12-08 21:23:56
问题 I want to plot a centered legend outside of the plotting area in a device having multiple plots. There has been many questions (with slight variations) asked in SO about changing the position of legend in a R plot. For example: 1) R - Common title and legend for combined plots 2) Common legend for multiple plots in R 3) Plot a legend outside of the plotting area in base graphics? etc. Now what I understood from the above questions is that I got to set the option xpd = T or xpd = NA to plot

How to control the legend in Seaborn - Python

时光毁灭记忆、已成空白 提交于 2019-12-08 13:29:19
问题 I am trying to find guidance on how to control and customize the legend in Seaborn plots but I can not find any. To make the issue more concrete I provide a reproducible example: surveys_by_year_sex_long year sex wgt 0 2001 F 36.221914 1 2001 M 36.481844 2 2002 F 34.016799 3 2002 M 37.589905 %matplotlib inline from matplotlib import * from matplotlib import pyplot as plt import seaborn as sn sn.factorplot(x = "year", y = "wgt", data = surveys_by_year_sex_long, hue = "sex", kind = "bar",

How to Change Legend Text of a Chart Object in Crystal Reports 10

让人想犯罪 __ 提交于 2019-12-08 12:20:59
问题 How to Change Legend Text of a Chart Object in Crystal Reports 10? I did a report with chart by Crystal Report. The chart show me how many males and females there. So now the male enter to database as int = 0, and the females enter to database as int = 1, so in legend of chart display 0 = 226 and 1 = 44, means that the Males = 226, and the Females = 44. I need to make a formula that can change the 0 to Males, and the 1 to Females. please see the picture below: See the Format Object I couldnot