legend

Having all layers in the legend with ggplot

邮差的信 提交于 2019-12-30 06:32:13
问题 how could I make a legend representing all the curves that are plotted in my graph ? Presently, an automatic legend is generated for the first layer (based on the "colour" aesthetic), but the other layer (the black curve representing the density of "price" variable across all observations) in not contained in this legend. I conceive that my question comes certainly from an incomplete understanding of the concepts behing ggplot package. ggplot(diamonds) + geom_density(aes(x = price, y = .

Having all layers in the legend with ggplot

岁酱吖の 提交于 2019-12-30 06:31:28
问题 how could I make a legend representing all the curves that are plotted in my graph ? Presently, an automatic legend is generated for the first layer (based on the "colour" aesthetic), but the other layer (the black curve representing the density of "price" variable across all observations) in not contained in this legend. I conceive that my question comes certainly from an incomplete understanding of the concepts behing ggplot package. ggplot(diamonds) + geom_density(aes(x = price, y = .

removing a layer legend in ggplot

拥有回忆 提交于 2019-12-30 06:17:28
问题 Another ggplot legend question! I have a dataset of the form test <- data.frame( cond = factor(rep(c("A", "B"), each=200)), value = c(rnorm(200), rnorm(200, mean=0.8)) ) So two groups and some values and I want to plot the density. I also want to add a line indicating the mean for each group to the plot so I: test.cdf <- ddply(test, .(cond), summarise, value.mean=mean(value)) Then in ggplot call: ggplot(test, aes(value, fill=cond)) + geom_density(alpha=0.5) + labs(x='Energy', y='Density',

How to prevent legend labels being cut off in Google charts

折月煮酒 提交于 2019-12-30 05:37:19
问题 With a Perl script I generate numerous Google Line Charts for 20 and more series of data at once. The legend labels are of the form: a serial number appended by an iterating #counter. Unfortunately, starting with #10 those counters are cut off: Is there maybe a way to stop Google charts from doing that? My quite simple chart code is below: var data = { ...... }; function drawCharts() { for (var csv in data) { var x = new google.visualization.DataTable(data[csv]); var options = { title: csv,

matplotlib - Legend in separate subplot

自闭症网瘾萝莉.ら 提交于 2019-12-30 03:09:09
问题 I am plotting an array of pie charts, each using the same two colors for the same two types of data. plt.figure(num=None, figsize=(6, 8)) for i in range(len(data_1)): plt.subplot(sp_rows, sp_cols, i+1) fracs = [data_1[i], data_2[i]] plt.pie(fracs, autopct='%1.1f%%') pp.savefig() Obviously it doesn't make sense to plot a legend for every one of these charts, since they are all the same. So is there any way I can plot a single legend into a separate subfigure at the end? 回答1: You can call

Combined line & bar geoms: How to generate proper legend?

心已入冬 提交于 2019-12-30 02:21:06
问题 The legend for d2 looks fine; for d1 , I would like to show just the hoizontal line against a white/transparent backgounnd. df = data.frame( Date = c("2012-11-30", "2012-12-03", "2012-12-04"), d1 = c(9, 5, 11), d2 = c(4, 6, 3) ) ggplot(df, aes(Date)) + geom_bar(aes(y = d2, color = "d2"), stat="identity", fill = "red") + geom_line(aes(y = d1, group = 1, color = "d1")) + scale_colour_manual("", values=c("d1" = "blue", "d2" = "red")) 回答1: It is not an elegant solution but at least it gives some

legend tag and Chrome

a 夏天 提交于 2019-12-30 01:19:13
问题 I've looked everywhere but to no avail. I got a <legend> in a form, which displays as I want in every browsers, except in Chrome. It's like it sits outside of the fieldset, or it's like it goes on top of the next element. And it's very annoying. I can't even put margins on it. Why does it display like in that way? And is there a workaround? HTML: <fieldset class="col-12-box-bottom add-extras"> <legend class="plus">Add Promotion Code</legend> <ul id="promo-fields"> <li><input class="field

Microsoft Chart Controls Legend Item Ordering

↘锁芯ラ 提交于 2019-12-29 09:13:45
问题 I've got a chart with 8 series - call them S1 through S8. They're in order in the chart's list of series, and they're presented using custom legend items (Legend.CustomItems). Everything works fine, except there seems to be a bug with how items are displayed in the legend when the legend wraps around to a new line. I'd like the items to be displayed in rows: S1 S2 S3 S4 S5 S6 S7 S8 Unfortunately, it seems like when the legend detects that it's going to take two rows, it fills in vertically

Custom legend of several lines with two markers for the same text

China☆狼群 提交于 2019-12-29 09:13:16
问题 I would like perform the type of legend shown in the figure . That figure I did with some tricks just to represent what I really want so it does not show well the color of the pink markers in the legend. In the figure the circles represent the same parameter but for two different models; the same is true for the triangular and square markers. I want to place the two circular markers referring to the same parameter in the first line of the legend, and analogously for the two other markers on

Microsoft Chart Controls Legend Item Ordering

戏子无情 提交于 2019-12-29 09:13:05
问题 I've got a chart with 8 series - call them S1 through S8. They're in order in the chart's list of series, and they're presented using custom legend items (Legend.CustomItems). Everything works fine, except there seems to be a bug with how items are displayed in the legend when the legend wraps around to a new line. I'd like the items to be displayed in rows: S1 S2 S3 S4 S5 S6 S7 S8 Unfortunately, it seems like when the legend detects that it's going to take two rows, it fills in vertically