legend

tabular legend layout for matplotlib

做~自己de王妃 提交于 2019-11-27 06:05:19
问题 I have a plot with 9 lines, representing datasets with two varying parameters, say f_11, f_12, f_13, ..., f_33. To make the plot (a bit) clearer, I encode the first parameter as the color of the line and the second one as the linestyle (so f_11 is red & dashed, f12 is red & dotted, f21 is green & dashed, f22 is green & dotted, etc.). So, for the legend, I would like to make a 3x3 table, looking like | value1 | value2 | value3 --------------------------------- value1 | value2 | <artists go

How to add data table with legend keys to a MS Chart in C#?

纵饮孤独 提交于 2019-11-27 05:41:38
There are 2 lists called listversion & MIN_list . Using values of these list I have created a line chart. Everything is work fine. But I am wondering whether it is possible to add a data table with legend keys in to the chart like MS Excel. chart.Series.Clear(); chart.ChartAreas[0].AxisX.Title = "Version"; chart.ChartAreas[0].AxisX.TitleFont = new System.Drawing.Font("Arial", 12, FontStyle.Regular); chart.ChartAreas[0].AxisY.Title = "Time"; chart.ChartAreas[0].AxisY.TitleFont = new System.Drawing.Font("Arial", 12, FontStyle.Regular); Series MIN = chart.Series.Add("Minimum"); MIN.Points

Legend on bottom, two rows wrapped in ggplot2 in r

风流意气都作罢 提交于 2019-11-27 05:24:25
问题 Rdates <- c("2007-01-31","2007-02-28","2007-03-30","2007-04-30","2007-05-31","2007-06-29","2007-07-31","2007-08-31","2007-09-28","2007-10-31") Rdates <- as.Date(Rdates) Cnames <- c("Column 1 Really Long","Column 2 Really Long","Column 3 Really Long","Column 4 Really Long","Column 5 Really Long","Column 6 Really Long","Column 7 Really Long","Column 8 Really Long","Column 9 Really Long","Column 10 Really Long") MAINDF <- data.frame(replicate(10,runif(10,-0.03,0.03))) rownames(MAINDF) <- Rdates

Is it possible to define the “mid” range in scale_fill_gradient2()?

会有一股神秘感。 提交于 2019-11-27 05:21:31
I am creating a heat map using ggplot() , and would like to utilize the 3 color scheme of scale_fill_gradient2() . I've found, however that the middle color is too broad and tends to display some of my data negatively (using "black" for example). Is it possible to define the range that is considered "mid," to make it more narrow? If not, is there a better way that I may do so? Data Set: structure(list(var1 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,

Subheadings for categories within matplotlib custom legend

拜拜、爱过 提交于 2019-11-27 05:20:00
I have a a figure that looks like this: I'd like to make a legend that looks like this: How can I do that? UPDATE: Note that this legend has a frame with an edgecolor: a valid answer will include this. The legend should also be embedded in the axes. The legend I want might not be achievable using ax.legend() . A great answer would be one which shows how to build my desired legend (exactly as shown) manually with patches and texts, or whatever matplotlib methods that make sense. Separate headings for D and A lines: from matplotlib.pyplot import * ds = [1,2,3] dc = [1.1, 1.9, 3.2] asim = [1.5, 2

How to create a draggable legend in matplotlib?

こ雲淡風輕ζ 提交于 2019-11-27 05:12:10
问题 I'm drawing a legend on an axes object in matplotlib but the default positioning which claims to place it in a smart place doesn't seem to work. Ideally, I'd like to have the legend be draggable by the user. How can this be done? 回答1: Note: This is now built into matplotlib leg = plt.legend() if leg: leg.draggable() will work as expected Well, I found bits and pieces of the solution scattered among mailing lists. I've come up with a nice modular chunk of code that you can drop in and use...

Remove legend ggplot 2.2

允我心安 提交于 2019-11-27 05:00:44
问题 I'm trying to keep the legend of one layer (smooth) and remove the legend of the other (point). I have tried shutting off the legends with guides(colour = FALSE) and geom_point(aes(color = vs), show.legend = FALSE) . Edit : As this question and its answers are popular, a reproducible example seems in order: library(ggplot2) ggplot(data = mtcars, aes(x = mpg, y = disp, group = gear)) + geom_point(aes(color = vs)) + geom_point(aes(shape = factor(cyl))) + geom_line(aes(linetype = factor(gear)))

Add abline to legend

穿精又带淫゛_ 提交于 2019-11-27 04:53:50
问题 First, sorry for posting without reproducible data. Hope you guys understand my question. This is my code. At the end of the code, I am trying to add abline. With the code, I am trying to add the name of abline to the legend but it does not work. ggplot(aes(x = week_id2, y = Index, color = Chain2, linetype = Chain2, group = Chain2), data = data00 + geom_point(aes(shape=Chain2), size = 3) + geom_line() + scale_linetype_manual(values=c("twodash", "dashed", "dotted", "dotdash", "longdash")) +

increase the linewidth of the legend lines in matplotlib

不羁的心 提交于 2019-11-27 04:17:09
问题 I know that if I change the linewidth of a line, that is automatically updated in the legend. However I would like to just change the legend linewidth without affecting the plot. 回答1: Here's a simple example of how to do it: import numpy as np import matplotlib.pyplot as plt # make some data x = np.linspace(0, 2*np.pi) y1 = np.sin(x) y2 = np.cos(x) # plot sin(x) and cos(x) p1 = plt.plot(x, y1, 'b-', linewidth=1.0) p2 = plt.plot(x, y2, 'r-', linewidth=1.0) # make a legend for both plots leg =

ggplot2: Divide Legend into Two Columns, Each with Its Own Title

只愿长相守 提交于 2019-11-27 03:58:16
I have these factors require(ggplot2) names(table(diamonds$cut)) # [1] "Fair" "Good" "Very Good" "Premium" "Ideal" which I want to visually divide into two groups in the legend (indicating also the group name): "First group" -> "Fair", "Good" and "Second group" -> "Very Good", "Premium", "Ideal" Starting with this plot ggplot(diamonds, aes(color, fill=cut)) + geom_bar() + guides(fill=guide_legend(ncol=2)) + theme(legend.position="bottom") I want to get (note that "Very Good" slipped in the second column/group) eipi10 You can shift the "Very Good" category to the second column of the legend by